Spaces:
Paused
Paused
Fabrice-TIERCELIN
commited on
Commit
•
57363eb
1
Parent(s):
4fe413f
All the results have the same size
Browse files- gradio_demo.py +15 -13
gradio_demo.py
CHANGED
@@ -203,6 +203,9 @@ def stage2_process(
|
|
203 |
for i, result in enumerate(results):
|
204 |
Image.fromarray(result).save(f'./history/{event_id[:5]}/{event_id[5:]}/HQ_{i}.png')
|
205 |
|
|
|
|
|
|
|
206 |
print('End stage2_process')
|
207 |
end = time.time()
|
208 |
secondes = int(end - start)
|
@@ -212,7 +215,7 @@ def stage2_process(
|
|
212 |
minutes = minutes - (hours * 60)
|
213 |
information = ("Restart the process to get another result. " if randomize_seed else "") + "The image(s) has(ve) been generated in " + ((str(hours) + " h, ") if hours != 0 else "") + ((str(minutes) + " min, ") if hours != 0 or minutes != 0 else "") + str(secondes) + " sec."
|
214 |
|
215 |
-
return [
|
216 |
|
217 |
def load_and_reset(param_setting):
|
218 |
print('Start load_and_reset')
|
@@ -296,18 +299,17 @@ with gr.Blocks(title="SUPIR") as interface:
|
|
296 |
""")
|
297 |
gr.HTML(title_html)
|
298 |
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
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.")
|
311 |
|
312 |
with gr.Accordion("Pre-denoising (optional)", open=False):
|
313 |
gamma_correction = gr.Slider(label="Gamma Correction", minimum=0.1, maximum=2.0, value=1.0, step=0.1)
|
|
|
203 |
for i, result in enumerate(results):
|
204 |
Image.fromarray(result).save(f'./history/{event_id[:5]}/{event_id[5:]}/HQ_{i}.png')
|
205 |
|
206 |
+
# All the results have the same size
|
207 |
+
result_height, result_width, result_channel = np.array(results[0]).shape
|
208 |
+
|
209 |
print('End stage2_process')
|
210 |
end = time.time()
|
211 |
secondes = int(end - start)
|
|
|
215 |
minutes = minutes - (hours * 60)
|
216 |
information = ("Restart the process to get another result. " if randomize_seed else "") + "The image(s) has(ve) been generated in " + ((str(hours) + " h, ") if hours != 0 else "") + ((str(minutes) + " min, ") if hours != 0 or minutes != 0 else "") + str(secondes) + " sec."
|
217 |
|
218 |
+
return [noisy_image] + results, [noisy_image] + results, gr.update(value = information, visible = True), event_id
|
219 |
|
220 |
def load_and_reset(param_setting):
|
221 |
print('Start load_and_reset')
|
|
|
299 |
""")
|
300 |
gr.HTML(title_html)
|
301 |
|
302 |
+
input_image = gr.Image(label="Input", show_label=True, type="numpy", height=600, elem_id="image-input")
|
303 |
+
prompt = gr.Textbox(label="Image description for LlaVa", value="", placeholder="A person, walking, in a town, Summer, photorealistic", lines=3, visible=False)
|
304 |
+
upscale = gr.Radio([1, 2, 3, 4, 5, 6, 7, 8], label="Upscale factor", info="Resolution x1 to x8", value=2, interactive=True)
|
305 |
+
a_prompt = gr.Textbox(label="Image description (optional)",
|
306 |
+
info="Help the AI to understand what the image represents; describe as much as possible",
|
307 |
+
value='Cinematic, High Contrast, highly detailed, taken using a Canon EOS R '
|
308 |
+
'camera, hyper detailed photo - realistic maximum detail, 32k, Color '
|
309 |
+
'Grading, ultra HD, extreme meticulous detailing, skin pore detailing, '
|
310 |
+
'hyper sharpness, perfect without deformations.',
|
311 |
+
lines=3)
|
312 |
+
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.")
|
|
|
313 |
|
314 |
with gr.Accordion("Pre-denoising (optional)", open=False):
|
315 |
gamma_correction = gr.Slider(label="Gamma Correction", minimum=0.1, maximum=2.0, value=1.0, step=0.1)
|