File size: 1,262 Bytes
78dcb0e
67370c5
06229a5
 
 
 
 
 
78dcb0e
c3699bb
06229a5
c3699bb
78dcb0e
 
 
06229a5
 
 
78dcb0e
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os
os.system("pip install gdown lpips gradio")
os.system("gdown --id 1HKmjg6iXsWr4aFPuU0gBXPGR83wqMzq7 -O align.dat")
os.system("wget https://nvlabs-fi-cdn.nvidia.com/stylegan2-ada-pytorch/pretrained/ffhq.pkl")
os.system("gdown https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-linux.zip")
os.system("unzip -d /usr/local/bin/")
os.system("sudo update-alternatives --install /usr/bin/ninja ninja /usr/local/bin/ninja 1 --force")
os.mkdir("embeddings/")


import gradio as gr



def inference(img):
    img.save("images/file.png")
    os.system("python tune.py")
    return 
  
title = "Pivotal Tuning for Latent Based Real Image Editing"
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."
article = "<p style='text-align: center'><a href='https://github.com/danielroich/PTI' target='_blank'>Github Repo Pytorch</a>"
gr.Interface(inference, [gr.inputs.Image(type="pil")], gr.outputs.Image(type="pil"),title=title,description=description,article=article,allow_flagging=False,allow_screenshot=False,enable_queue=True).launch(share=True)