File size: 1,275 Bytes
e5c66a0
 
44df4f1
fe2741a
e5c66a0
 
3000b36
41d1a70
101a286
8374f2f
e5c66a0
 
c1103a3
e5c66a0
 
 
1fe5aba
b88eb8a
e5c66a0
 
 
 
 
 
 
fd53425
edf321b
8374f2f
e5c66a0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os
import gradio as gr

os.system("git clone https://github.com/AK391/realworld-stylegan2-encoder.git")
os.chdir("realworld-stylegan2-encoder")
os.system("pip install gdown")
os.system("pip install dlib")
os.system("gdown https://drive.google.com/uc?id=1i873OKcKjvpxiF0UBU4NzxlMMaD9qR5z")
os.system("wget https://github.com/kim-ninh/align_face_ffhq/raw/main/shape_predictor_68_face_landmarks.dat -P .")
os.system("wget https://i.imgur.com/dJVNQSF.jpg -O ./mona.jpg")

def inference(image):
  os.system("python scripts/test.py --align --ckpt ./e4e_encode_mobile_cartoon.pt --network e4e --platform torch --size 1024 --images_path "+image.name) 
  return "out.png"

title = "Encoder4editing"
description = "Gradio demo for Encoder4editing. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below."
article = "<p style='text-align: center'><a href='https://github.com/TalkUHulk/realworld-stylegan2-encoder' target='_blank'>Github Repo</a></p>"

gr.Interface(
    inference, 
    gr.inputs.Image(type="file", label="Input"), 
    gr.outputs.Image(type="file", label="Output"),
    title=title,
    description=description,
    article=article,
    enable_queue=True,
    examples=[['mona.jpg']]
    ).launch(debug=True)