PTI / app.py
ucalyptus's picture
Update app.py
67370c5
raw history blame
No virus
1.26 kB
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)