Fabrice-TIERCELIN commited on
Commit
df5a04e
·
verified ·
1 Parent(s): f0d71dd
Files changed (1) hide show
  1. gradio_demo.py +102 -1
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,6 +409,107 @@ 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)
 
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
+
413
+ gr.Examples(
414
+ fn = stage2_process,
415
+ inputs = [
416
+ input_image,
417
+ denoise_image,
418
+ prompt,
419
+ a_prompt,
420
+ n_prompt,
421
+ num_samples,
422
+ min_size,
423
+ downscale,
424
+ upscale,
425
+ edm_steps,
426
+ s_stage1,
427
+ s_stage2,
428
+ s_cfg,
429
+ randomize_seed,
430
+ seed,
431
+ s_churn,
432
+ s_noise,
433
+ color_fix_type,
434
+ diff_dtype,
435
+ ae_dtype,
436
+ gamma_correction,
437
+ linear_CFG,
438
+ linear_s_stage2,
439
+ spt_linear_CFG,
440
+ spt_linear_s_stage2,
441
+ model_select,
442
+ output_format
443
+ ],
444
+ outputs = [
445
+ result_slider,
446
+ result_gallery,
447
+ restore_information,
448
+ event_id
449
+ ],
450
+ examples = [
451
+ [
452
+ "./Examples/Example1.png",
453
+ None,
454
+ None,
455
+ "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.",
456
+ "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",
457
+ 1,
458
+ 1024,
459
+ 1,
460
+ 1,
461
+ 200,
462
+ -1,
463
+ 1,
464
+ 7.5,
465
+ False,
466
+ 42,
467
+ 5,
468
+ 1.003,
469
+ "Wavelet",
470
+ "fp16",
471
+ "bf16",
472
+ 1.0,
473
+ True,
474
+ 4,
475
+ False,
476
+ 0.,
477
+ "Quality",
478
+ "png"
479
+ ],
480
+ [
481
+ "./Examples/Example2.jpeg",
482
+ None,
483
+ None,
484
+ "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.",
485
+ "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",
486
+ 1,
487
+ 1024,
488
+ 1,
489
+ 1,
490
+ 200,
491
+ -1,
492
+ 1,
493
+ 7.5,
494
+ False,
495
+ 42,
496
+ 5,
497
+ 1.003,
498
+ "Wavelet",
499
+ "fp16",
500
+ "bf16",
501
+ 1.0,
502
+ True,
503
+ 4,
504
+ False,
505
+ 0.,
506
+ "Quality",
507
+ "png"
508
+ ],
509
+ ],
510
+ cache_examples = False,
511
+ )
512
+
513
  with gr.Row():
514
  gr.Markdown(claim_md)
515
  event_id = gr.Textbox(label="Event ID", value="", visible=False)