Spaces:
Runtime error
Runtime error
Ahsen Khaliq
commited on
Commit
•
3f2d4dc
1
Parent(s):
51513fc
Update app.py
Browse files
app.py
CHANGED
@@ -20,6 +20,7 @@ from model import *
|
|
20 |
from e4e_projection import projection as e4e_projection
|
21 |
|
22 |
from copy import deepcopy
|
|
|
23 |
|
24 |
os.makedirs('inversion_codes', exist_ok=True)
|
25 |
os.makedirs('style_images', exist_ok=True)
|
@@ -82,8 +83,8 @@ def inference(img):
|
|
82 |
original_my_sample = original_generator(my_w, input_is_latent=True)
|
83 |
my_sample = generator(my_w, input_is_latent=True)
|
84 |
npimage = my_sample[0].permute(1, 2, 0).detach().numpy()[:,:,::-1]
|
85 |
-
|
86 |
-
return
|
87 |
|
88 |
title = "JojoGAN"
|
89 |
description = "Gradio Demo for JoJoGAN: One Shot Face Stylization. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below."
|
@@ -91,4 +92,4 @@ description = "Gradio Demo for JoJoGAN: One Shot Face Stylization. To use it, si
|
|
91 |
article = "<p style='text-align: center'><a href='https://github.com/mchong6/JoJoGAN' target='_blank'>Github Repo Pytorch</a></p> <center><img src='https://visitor-badge.glitch.me/badge?page_id=akhaliq_jojogan' alt='visitor badge'></center> <p style='text-align: center'>samples from repo: <img src='https://raw.githubusercontent.com/mchong6/JoJoGAN/main/teaser.jpg' alt='animation'/></p>"
|
92 |
|
93 |
examples=[['iu.jpeg']]
|
94 |
-
gr.Interface(inference, [gr.inputs.Image(type="pil")], gr.outputs.Image(type="
|
20 |
from e4e_projection import projection as e4e_projection
|
21 |
|
22 |
from copy import deepcopy
|
23 |
+
import imageio
|
24 |
|
25 |
os.makedirs('inversion_codes', exist_ok=True)
|
26 |
os.makedirs('style_images', exist_ok=True)
|
83 |
original_my_sample = original_generator(my_w, input_is_latent=True)
|
84 |
my_sample = generator(my_w, input_is_latent=True)
|
85 |
npimage = my_sample[0].permute(1, 2, 0).detach().numpy()[:,:,::-1]
|
86 |
+
imageio.imwrite('filename.jpeg', npimage)
|
87 |
+
return 'filename.jpeg'
|
88 |
|
89 |
title = "JojoGAN"
|
90 |
description = "Gradio Demo for JoJoGAN: One Shot Face Stylization. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below."
|
92 |
article = "<p style='text-align: center'><a href='https://github.com/mchong6/JoJoGAN' target='_blank'>Github Repo Pytorch</a></p> <center><img src='https://visitor-badge.glitch.me/badge?page_id=akhaliq_jojogan' alt='visitor badge'></center> <p style='text-align: center'>samples from repo: <img src='https://raw.githubusercontent.com/mchong6/JoJoGAN/main/teaser.jpg' alt='animation'/></p>"
|
93 |
|
94 |
examples=[['iu.jpeg']]
|
95 |
+
gr.Interface(inference, [gr.inputs.Image(type="pil")], gr.outputs.Image(type="file"),title=title,description=description,article=article,enable_queue=True,allow_flagging=False,examples=examples).launch()
|