|
import os |
|
import gradio as gr |
|
|
|
os.system("git clone https://github.com/AK391/PAMA.git") |
|
|
|
os.chdir("PAMA") |
|
|
|
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): |
|
os.system("python main.py eval --content "+content+" --style "+style) |
|
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=[['/home/user/app/PAMA/Hoover_Tower_Stanford_January_2013.jpeg','/home/user/app/PAMA/1513px-Van_Gogh_-_Starry_Night_-_Google_Art_Project.jpeg']] |
|
gr.Interface( |
|
inference, |
|
[gr.inputs.Image(type="filepath", label="Content"),gr.inputs.Image(type="filepath", label="Style")], |
|
gr.outputs.Image(type="file", label="Output"), |
|
title=title, |
|
description=description, |
|
article=article, |
|
examples=examples |
|
).launch(enable_queue=True) |