ysharma HF staff commited on
Commit
fd4af18
1 Parent(s): d38f1ca

update layout and desc

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -66,7 +66,7 @@ with gr.Blocks() as demo:
66
  with gr.Row():
67
  image_in = gr.Image(type="pil", label="Start by uploading an image of a Cat or a Dog that you want to translate")
68
  with gr.Column():
69
- btn_inversion = gr.Button("Get input noise",visible=False )
70
  with gr.Row():
71
  blip_prompt = gr.Textbox(visible=False)
72
  inversion_file = gr.File(visible=False)
@@ -77,8 +77,9 @@ with gr.Blocks() as demo:
77
  task_name_radio = gr.Radio(choices = ["cat2dog", "dog2cat",], type="value", visible=False, label="Select a task that you want to accomplish") #, value="cat2dog"),
78
  btn_imageedit = gr.Button(value="Translate the image!",visible=False)
79
  html_tag = gr.HTML(value="""<h3 style="font-weight: 900; margin-bottom: 7px; margin-top: 5px;">
80
- Generate synthetic images using Stable Diffusion and Translate them on the fly using Pix2Pix-Zero</h3>""", visible=False)
81
- prompt_synth = gr.Textbox(visible=False, label="Type in a prompt to generate an Image using SD")
 
82
  btn_synth_image = gr.Button(value="Generate & Translate the SD image",visible=False)
83
  with gr.Row():
84
  image_synth = gr.Image(visible=False, label="Synthetic image generated by Stable Diffusion on the fly")
@@ -92,7 +93,7 @@ with gr.Blocks() as demo:
92
 
93
  task_name_radio.change(set_visible_true, [], btn_imageedit)
94
  task_name_radio.change(set_visible_true, [], image_out)
95
- task_name_radio.change(set_visible_true, [], html_tag)
96
 
97
  btn_imageedit.click(image_edit,[task_name_radio],[image_out])
98
  btn_imageedit.click(set_visible_False, [], btn_imageedit)
@@ -100,6 +101,7 @@ with gr.Blocks() as demo:
100
  btn_imageedit.click(set_visible_true, [], btn_synth_image)
101
  btn_imageedit.click(set_visible_true, [], image_synth)
102
  btn_imageedit.click(set_visible_true, [], image_synth_translated)
 
103
  btn_synth_image.click(synthetic_image_edit,[prompt_synth, task_name_radio],[image_synth, image_synth_translated])
104
 
105
  image_in.clear(set_visible_true, [], btn_inversion)
 
66
  with gr.Row():
67
  image_in = gr.Image(type="pil", label="Start by uploading an image of a Cat or a Dog that you want to translate")
68
  with gr.Column():
69
+ btn_inversion = gr.Button("Get input noise and image caption",visible=False )
70
  with gr.Row():
71
  blip_prompt = gr.Textbox(visible=False)
72
  inversion_file = gr.File(visible=False)
 
77
  task_name_radio = gr.Radio(choices = ["cat2dog", "dog2cat",], type="value", visible=False, label="Select a task that you want to accomplish") #, value="cat2dog"),
78
  btn_imageedit = gr.Button(value="Translate the image!",visible=False)
79
  html_tag = gr.HTML(value="""<h3 style="font-weight: 900; margin-bottom: 7px; margin-top: 5px;">
80
+ 🤩Generate images with Stable Diffusion and 🚀Translate on the fly🔥 using Pix2PixZero. Try it below -</h3><br>
81
+ Example - type a prompt like 'A small cat sitting on a blue ball', select the task as 'cat->dog' in this case, and press the button.""", visible=False)
82
+ prompt_synth = gr.Textbox(visible=False, label="Type in a prompt to generate an Image using SD", placeholder="A small cat sitting on a blue ball")
83
  btn_synth_image = gr.Button(value="Generate & Translate the SD image",visible=False)
84
  with gr.Row():
85
  image_synth = gr.Image(visible=False, label="Synthetic image generated by Stable Diffusion on the fly")
 
93
 
94
  task_name_radio.change(set_visible_true, [], btn_imageedit)
95
  task_name_radio.change(set_visible_true, [], image_out)
96
+ #task_name_radio.change(set_visible_true, [], html_tag)
97
 
98
  btn_imageedit.click(image_edit,[task_name_radio],[image_out])
99
  btn_imageedit.click(set_visible_False, [], btn_imageedit)
 
101
  btn_imageedit.click(set_visible_true, [], btn_synth_image)
102
  btn_imageedit.click(set_visible_true, [], image_synth)
103
  btn_imageedit.click(set_visible_true, [], image_synth_translated)
104
+ btn_imageedit.change(set_visible_true, [], html_tag)
105
  btn_synth_image.click(synthetic_image_edit,[prompt_synth, task_name_radio],[image_synth, image_synth_translated])
106
 
107
  image_in.clear(set_visible_true, [], btn_inversion)