M-DOL commited on
Commit
efe0a64
1 Parent(s): 341b2b1

added examples

Browse files
Files changed (3) hide show
  1. app.py +6 -4
  2. example1.jpg +0 -0
  3. example2.jpg +0 -0
app.py CHANGED
@@ -229,11 +229,10 @@ with blocks:
229
  "<div>Upload an image of your face, pick your desired output styles, pick any modifiers, and apply StyleGAN-based editing.</div>"
230
  )
231
  with gr.Row():
232
- with gr.Column():
233
  input_img = gr.Image(type="filepath", label="Input image")
234
  with gr.Column():
235
- style_choice = gr.CheckboxGroup(choices=editor.get_style_list(), default=editor.get_style_list(), type="value",
236
- label="Styles")
237
  alter = gr.Dropdown(
238
  choices=["None", "Masculine", "Feminine", "Smiling", "Frowning", "Young", "Old", "Short Hair",
239
  "Long Hair"], value="None", label="Additional Modifiers")
@@ -244,7 +243,10 @@ with blocks:
244
 
245
 
246
  img_button.click(fn=editor.edit_image, inputs=[alter, input_img, style_choice], outputs=img_output)
247
-
 
 
 
248
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2108.00946' target='_blank'>StyleGAN-NADA: CLIP-Guided Domain Adaptation of Image Generators</a> | <a href='https://stylegan-nada.github.io/' target='_blank'>Project Page</a> | <a href='https://github.com/rinongal/StyleGAN-nada' target='_blank'>Code</a></p> <center><img src='https://visitor-badge.glitch.me/badge?page_id=mjdolan.holiday_stylegan_nada' alt='visitor badge'></center>"
249
  gr.Markdown(article)
250
 
 
229
  "<div>Upload an image of your face, pick your desired output styles, pick any modifiers, and apply StyleGAN-based editing.</div>"
230
  )
231
  with gr.Row():
232
+ with gr.Column():
233
  input_img = gr.Image(type="filepath", label="Input image")
234
  with gr.Column():
235
+ style_choice = gr.CheckboxGroup(choices=editor.get_style_list(), default=editor.get_style_list(), type="value", label="Styles")
 
236
  alter = gr.Dropdown(
237
  choices=["None", "Masculine", "Feminine", "Smiling", "Frowning", "Young", "Old", "Short Hair",
238
  "Long Hair"], value="None", label="Additional Modifiers")
 
243
 
244
 
245
  img_button.click(fn=editor.edit_image, inputs=[alter, input_img, style_choice], outputs=img_output)
246
+ ex = gr.Examples(examples=[["Smiling", 'example1.jpg', editor.get_style_list()], ["Long Hair", 'example2.jpg', editor.get_style_list()]], fn=inference, inputs=[alter, input_image, style_choice],
247
+ outputs=[img_output], cache_examples=True,
248
+ run_on_click=True)
249
+ ex.dataset.headers = [""]
250
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2108.00946' target='_blank'>StyleGAN-NADA: CLIP-Guided Domain Adaptation of Image Generators</a> | <a href='https://stylegan-nada.github.io/' target='_blank'>Project Page</a> | <a href='https://github.com/rinongal/StyleGAN-nada' target='_blank'>Code</a></p> <center><img src='https://visitor-badge.glitch.me/badge?page_id=mjdolan.holiday_stylegan_nada' alt='visitor badge'></center>"
251
  gr.Markdown(article)
252
 
example1.jpg ADDED
example2.jpg ADDED