ucalyptus commited on
Commit
95f8de4
1 Parent(s): 98df4c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -6
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 Based Real Image Editing"
24
- description = "Gradio Demo for Pivotal Tuning Inversion. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below. Please use a cropped portrait picture for best results similar to the examples below."
25
- article = "<p style='text-align: center'><a href='https://github.com/danielroich/PTI' target='_blank'>Github Repo Pytorch</a>"
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)