Fabrice-TIERCELIN commited on
Commit
478d0c1
1 Parent(s): 706e01a

Update gradio_demo.py

Browse files
Files changed (1) hide show
  1. gradio_demo.py +103 -2
gradio_demo.py CHANGED
@@ -327,7 +327,6 @@ with gr.Blocks(title="SUPIR") as interface:
327
  input_image = gr.Image(label="Input", show_label=True, type="numpy", height=600, elem_id="image-input")
328
  with gr.Group():
329
  prompt = gr.Textbox(label="Image description for LlaVa", value="", placeholder="A person, walking, in a town, Summer, photorealistic", lines=3, visible=False)
330
- 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)
331
  a_prompt = gr.Textbox(label="Image description",
332
  info="Help the AI understand what the image represents; describe as much as possible",
333
  value='Cinematic, High Contrast, highly detailed, taken using a Canon EOS R '
@@ -336,6 +335,7 @@ with gr.Blocks(title="SUPIR") as interface:
336
  'hyper sharpness, perfect without deformations.',
337
  lines=3)
338
  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.")
 
339
  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)
340
 
341
  with gr.Accordion("Pre-denoising (optional)", open=False):
@@ -409,9 +409,110 @@ with gr.Blocks(title="SUPIR") as interface:
409
  fb_score = gr.Slider(label="Feedback Score", minimum=1, maximum=5, value=3, step=1, interactive=True)
410
  fb_text = gr.Textbox(label="Feedback Text", value="", placeholder='Please enter your feedback here.')
411
  submit_button = gr.Button(value="Submit Feedback")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
412
  with gr.Row():
413
  gr.Markdown(claim_md)
414
- event_id = gr.Textbox(label="Event ID", value="", visible=False)
415
 
416
  denoise_button.click(fn = check, inputs = [
417
  input_image
 
327
  input_image = gr.Image(label="Input", show_label=True, type="numpy", height=600, elem_id="image-input")
328
  with gr.Group():
329
  prompt = gr.Textbox(label="Image description for LlaVa", value="", placeholder="A person, walking, in a town, Summer, photorealistic", lines=3, visible=False)
 
330
  a_prompt = gr.Textbox(label="Image description",
331
  info="Help the AI understand what the image represents; describe as much as possible",
332
  value='Cinematic, High Contrast, highly detailed, taken using a Canon EOS R '
 
335
  'hyper sharpness, perfect without deformations.',
336
  lines=3)
337
  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.")
338
+ 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)
339
  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)
340
 
341
  with gr.Accordion("Pre-denoising (optional)", open=False):
 
409
  fb_score = gr.Slider(label="Feedback Score", minimum=1, maximum=5, value=3, step=1, interactive=True)
410
  fb_text = gr.Textbox(label="Feedback Text", value="", placeholder='Please enter your feedback here.')
411
  submit_button = gr.Button(value="Submit Feedback")
412
+ event_id = gr.Textbox(label="Event ID", value="", visible=False)
413
+
414
+ gr.Examples(
415
+ fn = stage2_process,
416
+ inputs = [
417
+ input_image,
418
+ denoise_image,
419
+ prompt,
420
+ a_prompt,
421
+ n_prompt,
422
+ num_samples,
423
+ min_size,
424
+ downscale,
425
+ upscale,
426
+ edm_steps,
427
+ s_stage1,
428
+ s_stage2,
429
+ s_cfg,
430
+ randomize_seed,
431
+ seed,
432
+ s_churn,
433
+ s_noise,
434
+ color_fix_type,
435
+ diff_dtype,
436
+ ae_dtype,
437
+ gamma_correction,
438
+ linear_CFG,
439
+ linear_s_stage2,
440
+ spt_linear_CFG,
441
+ spt_linear_s_stage2,
442
+ model_select,
443
+ output_format
444
+ ],
445
+ outputs = [
446
+ result_slider,
447
+ result_gallery,
448
+ restore_information,
449
+ event_id
450
+ ],
451
+ examples = [
452
+ [
453
+ "./Examples/Example1.png",
454
+ None,
455
+ None,
456
+ "Group of people, walking, happy, in the street, photorealistic, 8k, extremely detailled, Cinematic, High Contrast, highly detailed, taken using a Canon EOS R camera, hyper detailed photo - realistic maximum detail, 32k, Color Grading, ultra HD, extreme meticulous detailing, skin pore detailing, hyper sharpness, perfect without deformations.",
457
+ "painting, oil painting, illustration, drawing, art, sketch, anime, cartoon, CG Style, 3D render, unreal engine, blurring, bokeh, ugly, dirty, messy, worst quality, low quality, frames, watermark, signature, jpeg artifacts, deformed, lowres, over-smooth",
458
+ 1,
459
+ 1024,
460
+ 1,
461
+ 1,
462
+ 200,
463
+ -1,
464
+ 1,
465
+ 7.5,
466
+ False,
467
+ 42,
468
+ 5,
469
+ 1.003,
470
+ "Wavelet",
471
+ "fp16",
472
+ "bf16",
473
+ 1.0,
474
+ True,
475
+ 4,
476
+ False,
477
+ 0.,
478
+ "v0-Q",
479
+ "png"
480
+ ],
481
+ [
482
+ "./Examples/Example2.jpeg",
483
+ None,
484
+ None,
485
+ "The head of a tabby cat, in a house, photorealistic, 8k, extremely detailled, Cinematic, High Contrast, highly detailed, taken using a Canon EOS R camera, hyper detailed photo - realistic maximum detail, 32k, Color Grading, ultra HD, extreme meticulous detailing, skin pore detailing, hyper sharpness, perfect without deformations.",
486
+ "painting, oil painting, illustration, drawing, art, sketch, anime, cartoon, CG Style, 3D render, unreal engine, blurring, bokeh, ugly, dirty, messy, worst quality, low quality, frames, watermark, signature, jpeg artifacts, deformed, lowres, over-smooth",
487
+ 1,
488
+ 1024,
489
+ 1,
490
+ 1,
491
+ 200,
492
+ -1,
493
+ 1,
494
+ 7.5,
495
+ False,
496
+ 42,
497
+ 5,
498
+ 1.003,
499
+ "Wavelet",
500
+ "fp16",
501
+ "bf16",
502
+ 1.0,
503
+ True,
504
+ 4,
505
+ False,
506
+ 0.,
507
+ "v0-Q",
508
+ "png"
509
+ ],
510
+ ],
511
+ cache_examples = False,
512
+ )
513
+
514
  with gr.Row():
515
  gr.Markdown(claim_md)
 
516
 
517
  denoise_button.click(fn = check, inputs = [
518
  input_image