Hide LlaVa
Browse files- gradio_demo.py +6 -9
gradio_demo.py
CHANGED
|
@@ -74,7 +74,6 @@ def update_seed(is_randomize_seed, seed):
|
|
| 74 |
def check(input_image):
|
| 75 |
if input_image is None:
|
| 76 |
raise gr.Error("Please provide an image to restore.")
|
| 77 |
-
return [input_image, input_image, input_image]
|
| 78 |
|
| 79 |
def reset_feedback():
|
| 80 |
return 3, ''
|
|
@@ -241,10 +240,9 @@ else:
|
|
| 241 |
title_md = """
|
| 242 |
<h1><center>SUPIR Image Upscaler</center></h1>
|
| 243 |
|
| 244 |
-
<p>SUPIR is a practicing model scaling for photo-realistic image restoration. It is still a research project under tested and is not yet a stable commercial product.
|
| 245 |
|
| 246 |
<a href="https://arxiv.org/abs/2401.13627">Paper</a>   <a href="http://supir.xpixel.group/">Project Page</a>   <a href="https://github.com/Fanghua-Yu/SUPIR/blob/master/assets/DemoGuide.png">How to play</a>   <a href="https://huggingface.co/blog/MonsterMMORPG/supir-sota-image-upscale-better-than-magnific-ai">Local Install Guide</a></p>
|
| 247 |
-
<p style="background-color: blue;">LLaVa is disabled.</p>
|
| 248 |
"""
|
| 249 |
|
| 250 |
|
|
@@ -277,7 +275,7 @@ with gr.Blocks(title="SUPIR") as interface:
|
|
| 277 |
with gr.Accordion("Pre-denoising options", open=False):
|
| 278 |
gamma_correction = gr.Slider(label="Gamma Correction", minimum=0.1, maximum=2.0, value=1.0, step=0.1)
|
| 279 |
|
| 280 |
-
with gr.Accordion("LLaVA options", open=False):
|
| 281 |
temperature = gr.Slider(label="Temperature", info = "lower=Always similar, higher=More creative", minimum=0., maximum=1.0, value=0.2, step=0.1)
|
| 282 |
top_p = gr.Slider(label="Top P", info = "Percent of tokens shortlisted", minimum=0., maximum=1.0, value=0.7, step=0.1)
|
| 283 |
qs = gr.Textbox(label="Question", info="Ask LLaVa what description you want", value="Describe the image and its style in a very detailed manner. The image is a realistic photography, not an art painting.", lines=3)
|
|
@@ -338,11 +336,10 @@ with gr.Blocks(title="SUPIR") as interface:
|
|
| 338 |
result_gallery = gr.Gallery(label='Output', show_label=False, elem_id="gallery1")
|
| 339 |
else:
|
| 340 |
result_gallery = ImageSlider(label='Output', show_label=False, elem_id="gallery1")
|
| 341 |
-
result_gallery2 = ImageSlider(label='Output', show_label=False, elem_id="gallery2")
|
| 342 |
with gr.Row():
|
| 343 |
with gr.Column():
|
| 344 |
denoise_button = gr.Button(value="Pre-denoise")
|
| 345 |
-
with gr.Column():
|
| 346 |
llave_button = gr.Button(value="Generate description by LlaVa (disabled)")
|
| 347 |
with gr.Column():
|
| 348 |
diffusion_button = gr.Button(value="🚀 Restore", variant = "primary")
|
|
@@ -363,7 +360,7 @@ with gr.Blocks(title="SUPIR") as interface:
|
|
| 363 |
|
| 364 |
denoise_button.click(fn = check, inputs = [
|
| 365 |
input_image
|
| 366 |
-
], outputs = [
|
| 367 |
input_image,
|
| 368 |
gamma_correction
|
| 369 |
], outputs=[
|
|
@@ -372,7 +369,7 @@ with gr.Blocks(title="SUPIR") as interface:
|
|
| 372 |
|
| 373 |
llave_button.click(fn = check, inputs = [
|
| 374 |
denoise_image
|
| 375 |
-
], outputs = [
|
| 376 |
denoise_image,
|
| 377 |
temperature,
|
| 378 |
top_p,
|
|
@@ -388,7 +385,7 @@ with gr.Blocks(title="SUPIR") as interface:
|
|
| 388 |
seed
|
| 389 |
], queue = False, show_progress = False).then(fn = check, inputs = [
|
| 390 |
input_image
|
| 391 |
-
], outputs = [
|
| 392 |
fb_score,
|
| 393 |
fb_text
|
| 394 |
], queue = False, show_progress = False).success(fn=stage2_process, inputs = [
|
|
|
|
| 74 |
def check(input_image):
|
| 75 |
if input_image is None:
|
| 76 |
raise gr.Error("Please provide an image to restore.")
|
|
|
|
| 77 |
|
| 78 |
def reset_feedback():
|
| 79 |
return 3, ''
|
|
|
|
| 240 |
title_md = """
|
| 241 |
<h1><center>SUPIR Image Upscaler</center></h1>
|
| 242 |
|
| 243 |
+
<p>SUPIR is a practicing model scaling for photo-realistic image restoration. It is still a research project under tested and is not yet a stable commercial product. LLaVa is not available in this demo. If you want to auto-generate the description of your image, use another <a href="https://huggingface.co/spaces/MaziyarPanahi/llava-llama-3-8b">LLaVa space</a>.
|
| 244 |
|
| 245 |
<a href="https://arxiv.org/abs/2401.13627">Paper</a>   <a href="http://supir.xpixel.group/">Project Page</a>   <a href="https://github.com/Fanghua-Yu/SUPIR/blob/master/assets/DemoGuide.png">How to play</a>   <a href="https://huggingface.co/blog/MonsterMMORPG/supir-sota-image-upscale-better-than-magnific-ai">Local Install Guide</a></p>
|
|
|
|
| 246 |
"""
|
| 247 |
|
| 248 |
|
|
|
|
| 275 |
with gr.Accordion("Pre-denoising options", open=False):
|
| 276 |
gamma_correction = gr.Slider(label="Gamma Correction", minimum=0.1, maximum=2.0, value=1.0, step=0.1)
|
| 277 |
|
| 278 |
+
with gr.Accordion("LLaVA options", open=False, visible=False):
|
| 279 |
temperature = gr.Slider(label="Temperature", info = "lower=Always similar, higher=More creative", minimum=0., maximum=1.0, value=0.2, step=0.1)
|
| 280 |
top_p = gr.Slider(label="Top P", info = "Percent of tokens shortlisted", minimum=0., maximum=1.0, value=0.7, step=0.1)
|
| 281 |
qs = gr.Textbox(label="Question", info="Ask LLaVa what description you want", value="Describe the image and its style in a very detailed manner. The image is a realistic photography, not an art painting.", lines=3)
|
|
|
|
| 336 |
result_gallery = gr.Gallery(label='Output', show_label=False, elem_id="gallery1")
|
| 337 |
else:
|
| 338 |
result_gallery = ImageSlider(label='Output', show_label=False, elem_id="gallery1")
|
|
|
|
| 339 |
with gr.Row():
|
| 340 |
with gr.Column():
|
| 341 |
denoise_button = gr.Button(value="Pre-denoise")
|
| 342 |
+
with gr.Column(visible=False):
|
| 343 |
llave_button = gr.Button(value="Generate description by LlaVa (disabled)")
|
| 344 |
with gr.Column():
|
| 345 |
diffusion_button = gr.Button(value="🚀 Restore", variant = "primary")
|
|
|
|
| 360 |
|
| 361 |
denoise_button.click(fn = check, inputs = [
|
| 362 |
input_image
|
| 363 |
+
], outputs = [], queue = False, show_progress = False).success(fn = stage1_process, inputs = [
|
| 364 |
input_image,
|
| 365 |
gamma_correction
|
| 366 |
], outputs=[
|
|
|
|
| 369 |
|
| 370 |
llave_button.click(fn = check, inputs = [
|
| 371 |
denoise_image
|
| 372 |
+
], outputs = [], queue = False, show_progress = False).success(fn = llave_process, inputs = [
|
| 373 |
denoise_image,
|
| 374 |
temperature,
|
| 375 |
top_p,
|
|
|
|
| 385 |
seed
|
| 386 |
], queue = False, show_progress = False).then(fn = check, inputs = [
|
| 387 |
input_image
|
| 388 |
+
], outputs = [], queue = False, show_progress = False).then(fn = reset_feedback, inputs = [], outputs = [
|
| 389 |
fb_score,
|
| 390 |
fb_text
|
| 391 |
], queue = False, show_progress = False).success(fn=stage2_process, inputs = [
|