Spaces:
Runtime error
Runtime error
File size: 1,768 Bytes
220ce32 1246fc1 220ce32 ba73120 cba9d82 220ce32 ba73120 220ce32 44e3c2a 56341cf 44e3c2a 220ce32 bc3c3f7 220ce32 |
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 32 33 34 35 36 37 38 39 |
import os
import gradio as gr
import sys
os.system("pip install gradio==2.4.6")
os.system("git clone https://github.com/jrossi6/PAMA.git")
os.chdir('PAMA')
os.system("wget https://upload.wikimedia.org/wikipedia/commons/thumb/1/1e/Hoover_Tower_Stanford_January_2013.jpg/800px-Hoover_Tower_Stanford_January_2013.jpg")
os.system("wget https://upload.wikimedia.org/wikipedia/commons/thumb/e/ea/Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg/1920px-Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg")
os.system("gdown https://drive.google.com/uc?id=1rPB_qnelVVSad6CtadmhRFi0PMI_RKdy")
os.mkdir("checkpoints/")
os.system("unzip -j original_PAMA.zip -d checkpoints/")
def inference(content,style,alpha):
os.system("python main.py eval --content "+content+" --style "+style+" --alpha " +str(alpha / 100.0))
return "ics.jpg"
title = "PAMA"
description = "Gradio demo for PAMA: Consistent Style Transfer. To use it, simply upload your images, 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/2201.02233' target='_blank'>Consistent Style Transfer</a> | <a href='https://github.com/computer-vision2022/PAMA' target='_blank'>Github Repo</a></p>"
examples=[['800px-Hoover_Tower_Stanford_January_2013.jpg','1920px-Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpg', 100.0]]
gr.Interface(
inference,
[
gr.inputs.Image(type="filepath", label="Content"),
gr.inputs.Image(type="filepath", label="Style"),
gr.inputs.Slider(0,100,default=100, label="Style Weight")
],
gr.outputs.Image(type="file", label="Output"),
title=title,
description=description,
article=article,
examples=examples,
enable_queue=True
).launch() |