pbudzyns/PAMA
0
1import os2 3import gradio as gr4 5os.system("bash install.sh")6 7 8def inference(content: str, style: str) -> str:9 os.system("cd PAMA && python main.py eval --content " + content + " --style " + style)10 return "PAMA/ics.jpg"11 12 13title = "PAMA"14description = (15 "<p style='text-align: center'>"16 "PAMA: Consistent Style Transfer. </br> To use it, simply upload "17 "your images, or click one of the examples to load them.</p>"18)19 20article = (21 "<p style='text-align: center'>"22 "<a href='https://arxiv.org/abs/2201.02233' target='_blank'>"23 "Consistent Style Transfer</a> | "24 "<a href='https://github.com/luoxuan-cs/PAMA' target='_blank'>"25 "Github Repo</a></p>"26)27 28examples = [29 ['samples/800px-Hoover_Tower_Stanford_January_2013.jpg',30 'samples/Leger_railway_crossing.jpg'],31 ['samples/800px-Robert_Downey_Jr_2014_Comic_Con_(cropped).jpg',32 'samples/1280px-El_Tres_de_Mayo,_by_Francisco_de_Goya,_from_Prado_thin_black_margin.jpg'],33 ['samples/800px-Taylor_Swift_2_-_2019_by_Glenn_Francis_(cropped)_3.jpg',34 'samples/WLANL_-_andrevanb_-_Falaises_près_de_Pourville,_Claude_Monet,_1882.jpg'],35]36 37 38def build_interface() -> gr.Interface:39 return gr.Interface(40 inference,41 inputs=[42 gr.Image(type="filepath", label="Content"),43 gr.Image(type="filepath", label="Style"),44 ],45 outputs=gr.Image(type="filepath", label="Output"),46 title=title,47 description=description,48 article=article,49 examples=examples,50 )51 52 53if __name__ == "__main__":54 interface = build_interface()55 interface.launch()56 