fffiloni commited on
Commit
a621996
·
verified ·
1 Parent(s): 28a6132

Update injection_main_HF.py

Browse files
Files changed (1) hide show
  1. injection_main_HF.py +47 -52
injection_main_HF.py CHANGED
@@ -586,51 +586,10 @@ if __name__ == "__main__":
586
 
587
  examples.append([entry["target_prompt"], image, None, None, None])
588
 
589
- text_input = gr.Textbox(
590
- value="An impressionist painting",
591
- label="Text Prompt",
592
- info="Describe the style you want to apply to the image, do not include the description of the image content itself",
593
- lines=2,
594
- placeholder="Enter a text prompt",
595
- )
596
- image_input = gr.Image(
597
- height="80%",
598
- width="80%",
599
- label="Content image (will be resized to 512x512)",
600
- interactive=True,
601
- )
602
- cfg_slider = gr.Slider(
603
- 0,
604
- 15,
605
- value=7.5,
606
- label="Classifier Free Guidance (CFG) Scale",
607
- info="higher values give more style, 7.5 should be good for most cases",
608
- )
609
- content_slider = gr.Slider(
610
- 0,
611
- 9,
612
- value=4,
613
- step=1,
614
- label="Number of content control layer",
615
- info="higher values make it more similar to original image. Default to control first 4 layers",
616
- )
617
- style_slider = gr.Slider(
618
- 0,
619
- 9,
620
- value=9,
621
- step=1,
622
- label="Number of style control layer",
623
- info="higher values make it more similar to target style. Default to control first 9 layers, usually not necessary to change.",
624
- )
625
- seed_slider = gr.Slider(
626
- 0,
627
- 100,
628
- value=0,
629
- step=1,
630
- label="Seed",
631
- info="Random seed for the model",
632
- )
633
- image_output= gr.Image(format="png")
634
 
635
  with gr.Blocks() as app:
636
 
@@ -638,17 +597,53 @@ if __name__ == "__main__":
638
  gr.Markdown("Artist Interactive Demo")
639
  with gr.Row():
640
  with gr.Column():
641
- text_input.render()
642
- image_input.render()
 
 
 
 
 
 
 
 
 
643
  with gr.Accordion("Advanced settings"):
644
  with gr.Column():
645
- cfg_slider.render()
646
- content_slider.render()
647
- style_slider.render()
648
- seed_slider.render()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
649
  submit_btn = gr.Button("Submit")
650
  with gr.Column():
651
- image_output.render()
652
  gr.Examples(
653
  examples = examples,
654
  inputs = [text_input, image_input],
 
586
 
587
  examples.append([entry["target_prompt"], image, None, None, None])
588
 
589
+
590
+
591
+
592
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
593
 
594
  with gr.Blocks() as app:
595
 
 
597
  gr.Markdown("Artist Interactive Demo")
598
  with gr.Row():
599
  with gr.Column():
600
+ text_input = gr.Textbox(
601
+ value="An impressionist painting",
602
+ label="Text Prompt",
603
+ info="Describe the style you want to apply to the image, do not include the description of the image content itself",
604
+ lines=2,
605
+ placeholder="Enter a text prompt",
606
+ )
607
+ image_input = gr.Image(
608
+ label="Content image (will be resized to 512x512)",
609
+ interactive=True,
610
+ )
611
  with gr.Accordion("Advanced settings"):
612
  with gr.Column():
613
+ cfg_slider = gr.Slider(
614
+ 0,
615
+ 15,
616
+ value=7.5,
617
+ label="Classifier Free Guidance (CFG) Scale",
618
+ info="higher values give more style, 7.5 should be good for most cases",
619
+ )
620
+ content_slider = gr.Slider(
621
+ 0,
622
+ 9,
623
+ value=4,
624
+ step=1,
625
+ label="Number of content control layer",
626
+ info="higher values make it more similar to original image. Default to control first 4 layers",
627
+ )
628
+ style_slider = gr.Slider(
629
+ 0,
630
+ 9,
631
+ value=9,
632
+ step=1,
633
+ label="Number of style control layer",
634
+ info="higher values make it more similar to target style. Default to control first 9 layers, usually not necessary to change.",
635
+ )
636
+ seed_slider = gr.Slider(
637
+ 0,
638
+ 100,
639
+ value=0,
640
+ step=1,
641
+ label="Seed",
642
+ info="Random seed for the model",
643
+ )
644
  submit_btn = gr.Button("Submit")
645
  with gr.Column():
646
+ image_output= gr.Image(format="png")
647
  gr.Examples(
648
  examples = examples,
649
  inputs = [text_input, image_input],