Ahsen Khaliq commited on
Commit
e5c66a0
1 Parent(s): c9e5bcc

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -0
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import gradio as gr
3
+ os.system("https://github.com/TalkUHulk/realworld-stylegan2-encoder.git")
4
+ os.chdir("realworld-stylegan2-encoder")
5
+ os.system("pip install gdown")
6
+ os.system("gdown https://drive.google.com/uc?id=1nrz2Oc5ljvixplPra55m_NGtGAtSSEOL")
7
+ os.system("gdown https://drive.google.com/uc?id=1WocJsMOsn6LP5NNZzhP9ErO7uz8gK8xI")
8
+
9
+ def inference(image):
10
+ os.system("""python scripts/test.py \
11
+ --ckpt_encoder ./art_mobile_encoder_1024p.onnx \
12
+ --ckpt_decoder ./art_decoder_1024p.onnx \
13
+ --network e4e \
14
+ --platform onnx \
15
+ --size 1024 \
16
+ --images_path """+image.name)
17
+
18
+ return "out.png"
19
+
20
+ title = "Encoder4editing"
21
+ description = "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."
22
+ article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2104.05703'>Adversarial Open Domain Adaption for Sketch-to-Photo Synthesis</a> | <a href='https://github.com/Mukosame/Anime2Sketch'>Github Repo</a></p>"
23
+
24
+ gr.Interface(
25
+ inference,
26
+ gr.inputs.Image(type="file", label="Input"),
27
+ gr.outputs.Image(type="file", label="Output"),
28
+ title=title,
29
+ description=description,
30
+ article=article
31
+ ).launch(debug=True)