ERAV2_S24 / app.py
Vasudevakrishna's picture
Update app.py
2c95727 verified
# import gradio as gr
# from PIL import Image
# from utils import generate_gradio_images
# # Create a Gradio interface
# iface = gr.Interface(
# fn=generate_gradio_images, # Set to None since we won't use a function
# inputs=[
# gr.Textbox(),
# gr.Slider("Time Stamps", value=1, step=1, maximum=50),
# gr.Checkbox(label = "Use custom loss",value=False)
# ],
# outputs=[gr.Image(type="pil", height=512, width = 512),
# gr.Image(type="pil", height=512, width = 512),
# gr.Image(type="pil", height=512, width = 512),
# gr.Image(type="pil", height=512, width = 512),
# gr.Image(type="pil", height=512, width = 512)] # Gradio Image component for displaying images
# )
# # Launch the Gradio interface
# iface.launch()
import gradio as gr
from PIL import Image
from utils import generate_gradio_images
width, height = 512, 512
# Create a Gradio interface
def gradio_app():
with gr.Blocks() as demo:
with gr.Column():
input_prompt = gr.Textbox(label="Enter Prompt")
input_slider = gr.Slider(label="Time Stamps", value=1, step=1, maximum=50)
input_checkbox = gr.Checkbox(label="Use custom loss", value=False)
with gr.Row():
output_image1 = gr.Image(type="pil", height=height, width=width)
output_image2 = gr.Image(type="pil", height=height, width=width)
output_image3 = gr.Image(type="pil", height=height, width=width)
output_image4 = gr.Image(type="pil", height=height, width=width)
output_image5 = gr.Image(type="pil", height=height, width=width)
inputs = [input_prompt, input_slider, input_checkbox]
outputs = [output_image1, output_image2, output_image3, output_image4, output_image5]
gr.Interface(fn=generate_gradio_images, inputs=inputs, outputs=outputs)
return demo
# Launch the Gradio interface
demo = gradio_app()
demo.launch()