File size: 1,241 Bytes
e5c66a0
 
fe2741a
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
30
31
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("gdown https://drive.google.com/uc?id=1nrz2Oc5ljvixplPra55m_NGtGAtSSEOL")
os.system("gdown https://drive.google.com/uc?id=1WocJsMOsn6LP5NNZzhP9ErO7uz8gK8xI")

def inference(image):
  os.system("""python scripts/test.py \
  --ckpt_encoder ./art_mobile_encoder_1024p.onnx \
  --ckpt_decoder ./art_decoder_1024p.onnx \
  --network e4e \
  --platform onnx \
  --size 1024 \
  --images_path """+image.name)
  
  return "out.png"

title = "Encoder4editing"
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."
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>"

gr.Interface(
    inference, 
    gr.inputs.Image(type="file", label="Input"), 
    gr.outputs.Image(type="file", label="Output"),
    title=title,
    description=description,
    article=article
    ).launch(debug=True)