demo / app.py
brios's picture
Update app.py
333f094
Raw History Blame Contribute Delete
1.62 kB
import os
import gradio as gr
def greet(content,style):
return os.path.join(os.path.dirname(__file__), "wedding_matisse.jpg")
def clean():
return None
content_examples = [
os.path.join(os.path.dirname(__file__), "bill-Groj66tpxi4-unsplash.jpg"),
os.path.join(os.path.dirname(__file__), "eugenivy_now-1Bs2sZ9fD2Q-unsplash.jpg")
]
content_image = gr.Image(label='Votre photo')
style_image = gr.Image(label='Votre style')
with gr.Blocks() as demo:
gr.Markdown(
"""
# Bienvenu sur la page de test de l'API de Phresque!
Vous pouvez directement importer vos images de test, ou bien cliquer sur les
exemples en bas de page
""")
with gr.Row():
with gr.Column():
content_image = gr.Image(label='Votre photo')
with gr.Column():
style_image = gr.Image(label='Votre style')
with gr.Column():
output = gr.Image(label='Résultat',interactive=False)
with gr.Row():
clean_content_btn = gr.Button(value="Effacer photo", variant="secondary")
clean_style_btn = gr.Button(value="Effacer style", variant="secondary")
submit_btn = gr.Button(value="Transformer", variant="primary")
examples = gr.Examples(
examples=[content_examples],
inputs=[content_image,style_image])
clean_content_btn.click(clean,inputs=[],outputs=[content_image])
clean_style_btn.click(clean,inputs=[],outputs=[style_image])
submit_btn.click(greet, inputs=[content_image, style_image], outputs=[output])
if __name__ == "__main__":
demo.launch(share=True)