Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import os
|
|
|
2 |
os.system("pip install gdown lpips gradio")
|
3 |
os.system("gdown --id 1HKmjg6iXsWr4aFPuU0gBXPGR83wqMzq7 -O align.dat")
|
4 |
os.system("wget https://nvlabs-fi-cdn.nvidia.com/stylegan2-ada-pytorch/pretrained/ffhq.pkl")
|
@@ -9,8 +10,6 @@ os.makedirs("embeddings/",exist_ok=True)
|
|
9 |
os.makedirs("checkpoints/",exist_ok=True)
|
10 |
os.makedirs("output/", exist_ok=True)
|
11 |
os.makedirs("images/",exist_ok=True)
|
12 |
-
|
13 |
-
|
14 |
import gradio as gr
|
15 |
|
16 |
|
@@ -18,9 +17,9 @@ import gradio as gr
|
|
18 |
def inference(img):
|
19 |
img.save("images/file.png")
|
20 |
os.system("python tune.py")
|
21 |
-
return
|
22 |
|
23 |
-
title = "Pivotal Tuning for Latent
|
24 |
-
description = "Gradio Demo for Pivotal Tuning Inversion. To use it, simply upload your image
|
25 |
-
article = "<p style='text-align: center'><a href='https://github.com/danielroich/PTI' target='_blank'>Github Repo
|
26 |
gr.Interface(inference, [gr.inputs.Image(type="pil")], gr.outputs.Image(type="pil"),title=title,description=description,article=article,allow_flagging='never',allow_screenshot=False).launch(share=True)
|
|
|
1 |
import os
|
2 |
+
from PIL import Image
|
3 |
os.system("pip install gdown lpips gradio")
|
4 |
os.system("gdown --id 1HKmjg6iXsWr4aFPuU0gBXPGR83wqMzq7 -O align.dat")
|
5 |
os.system("wget https://nvlabs-fi-cdn.nvidia.com/stylegan2-ada-pytorch/pretrained/ffhq.pkl")
|
|
|
10 |
os.makedirs("checkpoints/",exist_ok=True)
|
11 |
os.makedirs("output/", exist_ok=True)
|
12 |
os.makedirs("images/",exist_ok=True)
|
|
|
|
|
13 |
import gradio as gr
|
14 |
|
15 |
|
|
|
17 |
def inference(img):
|
18 |
img.save("images/file.png")
|
19 |
os.system("python tune.py")
|
20 |
+
return Image.open("output/out.png")
|
21 |
|
22 |
+
title = "Pivotal Tuning for Latent-based editing of Real Images"
|
23 |
+
description = "Gradio Demo for Pivotal Tuning Inversion. To use it, simply upload your image. Please use a cropped portrait picture for best results similar to the examples below."
|
24 |
+
article = "<p style='text-align: center'><a href='https://github.com/danielroich/PTI' target='_blank'>Github Repo</a>"
|
25 |
gr.Interface(inference, [gr.inputs.Image(type="pil")], gr.outputs.Image(type="pil"),title=title,description=description,article=article,allow_flagging='never',allow_screenshot=False).launch(share=True)
|