Changes from prod
Browse files- gradio_demo.py +5 -5
gradio_demo.py
CHANGED
|
@@ -79,7 +79,7 @@ def check(input_image):
|
|
| 79 |
def reset_feedback():
|
| 80 |
return 3, ''
|
| 81 |
|
| 82 |
-
@spaces.GPU(duration=
|
| 83 |
def stage1_process(input_image, gamma_correction):
|
| 84 |
print('stage1_process ==>>')
|
| 85 |
if torch.cuda.device_count() == 0:
|
|
@@ -101,7 +101,7 @@ def stage1_process(input_image, gamma_correction):
|
|
| 101 |
print('<<== stage1_process')
|
| 102 |
return LQ, gr.update(visible = True)
|
| 103 |
|
| 104 |
-
@spaces.GPU(duration=
|
| 105 |
def llave_process(input_image, temperature, top_p, qs=None):
|
| 106 |
print('llave_process ==>>')
|
| 107 |
if torch.cuda.device_count() == 0:
|
|
@@ -201,7 +201,7 @@ def stage2_process(
|
|
| 201 |
|
| 202 |
return result_slider, result_gallery, restore_information, event_id
|
| 203 |
|
| 204 |
-
@spaces.GPU(duration=
|
| 205 |
def restore(
|
| 206 |
model,
|
| 207 |
edm_steps,
|
|
@@ -336,7 +336,7 @@ title_html = """
|
|
| 336 |
LlaVa is not integrated in this demo. The content added by SUPIR is imagination, not real-world information.
|
| 337 |
The aim of SUPIR is the beauty and the illustration.
|
| 338 |
Most of the processes only last few minutes.
|
| 339 |
-
This demo can handle huge images but the process will be aborted if it lasts more than
|
| 340 |
|
| 341 |
<p><center><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></center></p>
|
| 342 |
"""
|
|
@@ -366,7 +366,6 @@ with gr.Blocks(title="SUPIR") as interface:
|
|
| 366 |
input_image = gr.Image(label="Input", show_label=True, type="numpy", height=600, elem_id="image-input")
|
| 367 |
with gr.Group():
|
| 368 |
prompt = gr.Textbox(label="Image description for LlaVa", value="", placeholder="A person, walking, in a town, Summer, photorealistic", lines=3, visible=False)
|
| 369 |
-
upscale = gr.Radio([["x1", 1], ["x2", 2], ["x3", 3], ["x4", 4], ["x5", 5], ["x6", 6], ["x7", 7], ["x8", 8]], label="Upscale factor", info="Resolution x1 to x8", value=2, interactive=True)
|
| 370 |
a_prompt = gr.Textbox(label="Image description",
|
| 371 |
info="Help the AI understand what the image represents; describe as much as possible",
|
| 372 |
value='Cinematic, High Contrast, highly detailed, taken using a Canon EOS R '
|
|
@@ -375,6 +374,7 @@ with gr.Blocks(title="SUPIR") as interface:
|
|
| 375 |
'hyper sharpness, perfect without deformations.',
|
| 376 |
lines=3)
|
| 377 |
a_prompt_hint = gr.HTML("You can use a <a href='"'https://huggingface.co/spaces/MaziyarPanahi/llava-llama-3-8b'"'>LlaVa space</a> to auto-generate the description of your image.")
|
|
|
|
| 378 |
output_format = gr.Radio([["*.png", "png"], ["*.webp", "webp"], ["*.jpeg", "jpeg"], ["*.gif", "gif"], ["*.bmp", "bmp"]], label="Image format for result", info="File extention", value="png", interactive=True)
|
| 379 |
|
| 380 |
with gr.Accordion("Pre-denoising (optional)", open=False):
|
|
|
|
| 79 |
def reset_feedback():
|
| 80 |
return 3, ''
|
| 81 |
|
| 82 |
+
@spaces.GPU(duration=540)
|
| 83 |
def stage1_process(input_image, gamma_correction):
|
| 84 |
print('stage1_process ==>>')
|
| 85 |
if torch.cuda.device_count() == 0:
|
|
|
|
| 101 |
print('<<== stage1_process')
|
| 102 |
return LQ, gr.update(visible = True)
|
| 103 |
|
| 104 |
+
@spaces.GPU(duration=540)
|
| 105 |
def llave_process(input_image, temperature, top_p, qs=None):
|
| 106 |
print('llave_process ==>>')
|
| 107 |
if torch.cuda.device_count() == 0:
|
|
|
|
| 201 |
|
| 202 |
return result_slider, result_gallery, restore_information, event_id
|
| 203 |
|
| 204 |
+
@spaces.GPU(duration=540)
|
| 205 |
def restore(
|
| 206 |
model,
|
| 207 |
edm_steps,
|
|
|
|
| 336 |
LlaVa is not integrated in this demo. The content added by SUPIR is imagination, not real-world information.
|
| 337 |
The aim of SUPIR is the beauty and the illustration.
|
| 338 |
Most of the processes only last few minutes.
|
| 339 |
+
This demo can handle huge images but the process will be aborted if it lasts more than 9 min.
|
| 340 |
|
| 341 |
<p><center><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></center></p>
|
| 342 |
"""
|
|
|
|
| 366 |
input_image = gr.Image(label="Input", show_label=True, type="numpy", height=600, elem_id="image-input")
|
| 367 |
with gr.Group():
|
| 368 |
prompt = gr.Textbox(label="Image description for LlaVa", value="", placeholder="A person, walking, in a town, Summer, photorealistic", lines=3, visible=False)
|
|
|
|
| 369 |
a_prompt = gr.Textbox(label="Image description",
|
| 370 |
info="Help the AI understand what the image represents; describe as much as possible",
|
| 371 |
value='Cinematic, High Contrast, highly detailed, taken using a Canon EOS R '
|
|
|
|
| 374 |
'hyper sharpness, perfect without deformations.',
|
| 375 |
lines=3)
|
| 376 |
a_prompt_hint = gr.HTML("You can use a <a href='"'https://huggingface.co/spaces/MaziyarPanahi/llava-llama-3-8b'"'>LlaVa space</a> to auto-generate the description of your image.")
|
| 377 |
+
upscale = gr.Radio([["x1", 1], ["x2", 2], ["x3", 3], ["x4", 4], ["x5", 5], ["x6", 6], ["x7", 7], ["x8", 8]], label="Upscale factor", info="Resolution x1 to x8", value=2, interactive=True)
|
| 378 |
output_format = gr.Radio([["*.png", "png"], ["*.webp", "webp"], ["*.jpeg", "jpeg"], ["*.gif", "gif"], ["*.bmp", "bmp"]], label="Image format for result", info="File extention", value="png", interactive=True)
|
| 379 |
|
| 380 |
with gr.Accordion("Pre-denoising (optional)", open=False):
|