jake commited on
Commit
19f9f59
Β·
1 Parent(s): 06b0a1f
Files changed (1) hide show
  1. app.py +49 -47
app.py CHANGED
@@ -576,6 +576,55 @@ with gr.Blocks(
576
  outputs=[v2s_audio_out, v2s_status],
577
  )
578
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
579
  # ---- I2S ----
580
  with gr.Tab("Image β†’ Speech (I2S)"):
581
  i2s_image_in = gr.Image(type="pil", label="Image input", sources=["upload"])
@@ -685,53 +734,6 @@ with gr.Blocks(
685
  outputs=[mmu_answer, mmu_status],
686
  )
687
 
688
- # ---- T2I ----
689
- with gr.Tab("Text β†’ Image (T2I)"):
690
- t2i_prompt = gr.Textbox(
691
- label="Prompt",
692
- lines=4,
693
- placeholder="Describe the image you want to generate...",
694
- )
695
- t2i_image_out = gr.Image(label="Generated image")
696
- t2i_status = gr.Textbox(label="Status", interactive=False)
697
- with gr.Accordion("Advanced settings", open=False):
698
- t2i_timesteps = gr.Slider(4, 128, value=32, step=2, label="Timesteps")
699
- t2i_temperature = gr.Slider(0.0, 2.0, value=1.0, step=0.05, label="Sampling temperature")
700
- t2i_guidance = gr.Slider(0.0, 8.0, value=3.5, step=0.1, label="CFG scale")
701
- if T2I_EXAMPLES:
702
- with gr.Accordion("Sample prompts", open=False):
703
- gr.Examples(
704
- examples=T2I_EXAMPLES,
705
- inputs=[t2i_prompt],
706
- examples_per_page=6,
707
- )
708
- t2i_btn = gr.Button("Generate image", variant="primary")
709
- t2i_btn.click(
710
- t2i_handler,
711
- inputs=[t2i_prompt, t2i_timesteps, t2i_temperature, t2i_guidance],
712
- outputs=[t2i_image_out, t2i_status],
713
- )
714
-
715
- # ---- I2I ----
716
- with gr.Tab("Image Editing (I2I)"):
717
- i2i_image_in = gr.Image(type="pil", label="Reference image", sources=["upload"])
718
- i2i_instr = gr.Textbox(
719
- label="Editing instruction",
720
- lines=4,
721
- placeholder="Describe how you want to edit the image...",
722
- )
723
- i2i_image_out = gr.Image(label="Edited image")
724
- i2i_status = gr.Textbox(label="Status", interactive=False)
725
- with gr.Accordion("Advanced settings", open=False):
726
- i2i_timesteps = gr.Slider(4, 128, value=18, step=2, label="Timesteps")
727
- i2i_temperature = gr.Slider(0.0, 2.0, value=1.0, step=0.05, label="Sampling temperature")
728
- i2i_guidance = gr.Slider(0.0, 8.0, value=3.5, step=0.1, label="CFG scale")
729
- i2i_btn = gr.Button("Apply edit", variant="primary")
730
- i2i_btn.click(
731
- i2i_handler,
732
- inputs=[i2i_instr, i2i_image_in, i2i_timesteps, i2i_temperature, i2i_guidance],
733
- outputs=[i2i_image_out, i2i_status],
734
- )
735
 
736
 
737
  if __name__ == "__main__":
 
576
  outputs=[v2s_audio_out, v2s_status],
577
  )
578
 
579
+
580
+ # ---- T2I ----
581
+ with gr.Tab("Text β†’ Image (T2I)"):
582
+ t2i_prompt = gr.Textbox(
583
+ label="Prompt",
584
+ lines=4,
585
+ placeholder="Describe the image you want to generate...",
586
+ )
587
+ t2i_image_out = gr.Image(label="Generated image")
588
+ t2i_status = gr.Textbox(label="Status", interactive=False)
589
+ with gr.Accordion("Advanced settings", open=False):
590
+ t2i_timesteps = gr.Slider(4, 128, value=32, step=2, label="Timesteps")
591
+ t2i_temperature = gr.Slider(0.0, 2.0, value=1.0, step=0.05, label="Sampling temperature")
592
+ t2i_guidance = gr.Slider(0.0, 8.0, value=3.5, step=0.1, label="CFG scale")
593
+ if T2I_EXAMPLES:
594
+ with gr.Accordion("Sample prompts", open=False):
595
+ gr.Examples(
596
+ examples=T2I_EXAMPLES,
597
+ inputs=[t2i_prompt],
598
+ examples_per_page=6,
599
+ )
600
+ t2i_btn = gr.Button("Generate image", variant="primary")
601
+ t2i_btn.click(
602
+ t2i_handler,
603
+ inputs=[t2i_prompt, t2i_timesteps, t2i_temperature, t2i_guidance],
604
+ outputs=[t2i_image_out, t2i_status],
605
+ )
606
+
607
+ # ---- I2I ----
608
+ with gr.Tab("Image Editing (I2I)"):
609
+ i2i_image_in = gr.Image(type="pil", label="Reference image", sources=["upload"])
610
+ i2i_instr = gr.Textbox(
611
+ label="Editing instruction",
612
+ lines=4,
613
+ placeholder="Describe how you want to edit the image...",
614
+ )
615
+ i2i_image_out = gr.Image(label="Edited image")
616
+ i2i_status = gr.Textbox(label="Status", interactive=False)
617
+ with gr.Accordion("Advanced settings", open=False):
618
+ i2i_timesteps = gr.Slider(4, 128, value=18, step=2, label="Timesteps")
619
+ i2i_temperature = gr.Slider(0.0, 2.0, value=1.0, step=0.05, label="Sampling temperature")
620
+ i2i_guidance = gr.Slider(0.0, 8.0, value=3.5, step=0.1, label="CFG scale")
621
+ i2i_btn = gr.Button("Apply edit", variant="primary")
622
+ i2i_btn.click(
623
+ i2i_handler,
624
+ inputs=[i2i_instr, i2i_image_in, i2i_timesteps, i2i_temperature, i2i_guidance],
625
+ outputs=[i2i_image_out, i2i_status],
626
+ )
627
+
628
  # ---- I2S ----
629
  with gr.Tab("Image β†’ Speech (I2S)"):
630
  i2s_image_in = gr.Image(type="pil", label="Image input", sources=["upload"])
 
734
  outputs=[mmu_answer, mmu_status],
735
  )
736
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
737
 
738
 
739
  if __name__ == "__main__":