Spaces:
Runtime error
Runtime error
| # *************************************************************************** # | |
| # # | |
| # app.py # | |
| # # | |
| # By: Widium <ebennace@student.42lausanne.ch> # | |
| # Github : https://github.com/widium # | |
| # # | |
| # Created: 2023/05/05 15:49:55 by Widium # | |
| # Updated: 2023/05/05 15:49:55 by Widium # | |
| # # | |
| # **************************************************************************** # | |
| import sys | |
| import tensorflow as tf | |
| import keras | |
| import gradio as gr | |
| from gradio import Interface | |
| from functions.core import style_generation | |
| from functions.system.devices import get_available_devices | |
| get_available_devices() | |
| print(f"Python : {sys.version}") | |
| print(f"Gradio : {gr.__version__}") | |
| print(f"Tensorflow : {tf.__version__}") | |
| print(f"Keras : {keras.__version__}") | |
| # **************************************************************************** # | |
| def create_demo()->Interface: | |
| """ | |
| Creates a Gradio demo interface for the Style recreation model. | |
| 1. Defines input and output components for the interface. | |
| 2. Specifies example images for the interface. | |
| 3. Creates a Gradio Interface object with the specified components and examples. | |
| 4. Returns the Gradio Interface object. | |
| Returns: | |
| gradio.Interface: The Gradio demo interface for the Style recreation model. | |
| """ | |
| inputs_box = [ | |
| gr.Image(label="Style Image", type="filepath"), | |
| ] | |
| outputs_box = [ | |
| gr.Image(label="Style Recreation", type="pil"), | |
| gr.Number(label="Time to produce (sc)"), | |
| ] | |
| style_images = [ | |
| "examples/waves.png", | |
| ] | |
| demo = Interface( | |
| fn=style_generation, | |
| inputs=inputs_box, | |
| outputs=outputs_box, | |
| examples=style_images, | |
| ) | |
| return (demo) | |
| demo = create_demo() | |
| demo.launch() |