PAMA / app.py
pbudzyns
Add application file
25fa405
import os
import gradio as gr
os.system("bash install.sh")
def inference(content: str, style: str) -> str:
os.system("cd PAMA && python main.py eval --content " + content + " --style " + style)
return "PAMA/ics.jpg"
title = "PAMA"
description = (
"<p style='text-align: center'>"
"PAMA: Consistent Style Transfer. </br> To use it, simply upload "
"your images, or click one of the examples to load them.</p>"
)
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/luoxuan-cs/PAMA' target='_blank'>"
"Github Repo</a></p>"
)
examples = [
['samples/800px-Hoover_Tower_Stanford_January_2013.jpg',
'samples/Leger_railway_crossing.jpg'],
['samples/800px-Robert_Downey_Jr_2014_Comic_Con_(cropped).jpg',
'samples/1280px-El_Tres_de_Mayo,_by_Francisco_de_Goya,_from_Prado_thin_black_margin.jpg'],
['samples/800px-Taylor_Swift_2_-_2019_by_Glenn_Francis_(cropped)_3.jpg',
'samples/WLANL_-_andrevanb_-_Falaises_près_de_Pourville,_Claude_Monet,_1882.jpg'],
]
def build_interface() -> gr.Interface:
return gr.Interface(
inference,
inputs=[
gr.Image(type="filepath", label="Content"),
gr.Image(type="filepath", label="Style"),
],
outputs=gr.Image(type="filepath", label="Output"),
title=title,
description=description,
article=article,
examples=examples,
)
if __name__ == "__main__":
interface = build_interface()
interface.launch()