Spaces:
Sleeping
Sleeping
File size: 2,008 Bytes
2c95727 a2152cc 2c95727 a2152cc 2c95727 a2152cc 2c95727 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# 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() |