- app.py +16 -1
- requirements.txt +9 -0
- tune.py +1 -2
- upload_wandb.py +0 -9
app.py
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
def greet(num):
|
| 4 |
return num+69
|
| 5 |
|
| 6 |
iface = gr.Interface(fn=greet, inputs="number", outputs="number")
|
| 7 |
-
iface.launch(share=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
os.system("pip install gradio==2.4.6")
|
| 3 |
import gradio as gr
|
| 4 |
+
from PIL import Image
|
| 5 |
+
import torch
|
| 6 |
+
|
| 7 |
|
| 8 |
def greet(num):
|
| 9 |
return num+69
|
| 10 |
|
| 11 |
iface = gr.Interface(fn=greet, inputs="number", outputs="number")
|
| 12 |
+
iface.launch(share=True)
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def inference(img):
|
| 16 |
+
out = face2paint(model1, img)
|
| 17 |
+
return out
|
| 18 |
+
|
| 19 |
+
title = "Pivotal Tuning for Latent Based Real Image Editing"
|
| 20 |
+
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."
|
| 21 |
+
article = "<p style='text-align: center'><a href='https://github.com/danielroich/PTI' target='_blank'>Github Repo Pytorch</a>"
|
| 22 |
+
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)
|
requirements.txt
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
torch
|
| 2 |
+
torchvision
|
| 3 |
+
Pillow
|
| 4 |
+
gdown
|
| 5 |
+
numpy
|
| 6 |
+
scipy
|
| 7 |
+
cmake
|
| 8 |
+
onnxruntime-gpu
|
| 9 |
+
opencv-python-headless
|
tune.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
import wandb
|
| 2 |
import click
|
| 3 |
import os
|
| 4 |
import sys
|
|
@@ -11,7 +10,7 @@ from IPython.display import display
|
|
| 11 |
import matplotlib.pyplot as plt
|
| 12 |
from scripts.latent_editor_wrapper import LatentEditorWrapper
|
| 13 |
|
| 14 |
-
image_dir_name = '
|
| 15 |
use_multi_id_training = False
|
| 16 |
global_config.device = 'cuda'
|
| 17 |
paths_config.e4e = '/home/sayantan/PTI/pretrained_models/e4e_ffhq_encode.pt'
|
|
|
|
|
|
|
| 1 |
import click
|
| 2 |
import os
|
| 3 |
import sys
|
|
|
|
| 10 |
import matplotlib.pyplot as plt
|
| 11 |
from scripts.latent_editor_wrapper import LatentEditorWrapper
|
| 12 |
|
| 13 |
+
image_dir_name = 'images'
|
| 14 |
use_multi_id_training = False
|
| 15 |
global_config.device = 'cuda'
|
| 16 |
paths_config.e4e = '/home/sayantan/PTI/pretrained_models/e4e_ffhq_encode.pt'
|
upload_wandb.py
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
import wandb
|
| 2 |
-
api = wandb.Api()
|
| 3 |
-
run = api.run("masc/PTIseg/rhh4r09q")
|
| 4 |
-
import os
|
| 5 |
-
fils = os.listdir("/home/sayantan/processed_images")
|
| 6 |
-
|
| 7 |
-
for i in fils:
|
| 8 |
-
run.upload_file("/home/sayantan/processed_images/"+i,root="/home/sayantan/")
|
| 9 |
-
print("uploaded all")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|