Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,21 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from PIL import Image
|
| 3 |
from utils import generate_gradio_images
|
| 4 |
|
|
|
|
| 5 |
# Create a Gradio interface
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
# Launch the Gradio interface
|
| 21 |
-
|
|
|
|
|
|
| 1 |
+
# import gradio as gr
|
| 2 |
+
# from PIL import Image
|
| 3 |
+
# from utils import generate_gradio_images
|
| 4 |
+
|
| 5 |
+
# # Create a Gradio interface
|
| 6 |
+
# iface = gr.Interface(
|
| 7 |
+
# fn=generate_gradio_images, # Set to None since we won't use a function
|
| 8 |
+
# inputs=[
|
| 9 |
+
# gr.Textbox(),
|
| 10 |
+
# gr.Slider("Time Stamps", value=1, step=1, maximum=50),
|
| 11 |
+
# gr.Checkbox(label = "Use custom loss",value=False)
|
| 12 |
+
# ],
|
| 13 |
+
# outputs=[gr.Image(type="pil", height=512, width = 512),
|
| 14 |
+
# gr.Image(type="pil", height=512, width = 512),
|
| 15 |
+
# gr.Image(type="pil", height=512, width = 512),
|
| 16 |
+
# gr.Image(type="pil", height=512, width = 512),
|
| 17 |
+
# gr.Image(type="pil", height=512, width = 512)] # Gradio Image component for displaying images
|
| 18 |
+
# )
|
| 19 |
+
|
| 20 |
+
# # Launch the Gradio interface
|
| 21 |
+
# iface.launch()
|
| 22 |
+
|
| 23 |
import gradio as gr
|
| 24 |
from PIL import Image
|
| 25 |
from utils import generate_gradio_images
|
| 26 |
|
| 27 |
+
width, height = 512, 512
|
| 28 |
# Create a Gradio interface
|
| 29 |
+
def gradio_app():
|
| 30 |
+
with gr.Blocks() as demo:
|
| 31 |
+
with gr.Column():
|
| 32 |
+
input_prompt = gr.Textbox(label="Enter Prompt")
|
| 33 |
+
input_slider = gr.Slider(label="Time Stamps", value=1, step=1, maximum=50)
|
| 34 |
+
input_checkbox = gr.Checkbox(label="Use custom loss", value=False)
|
| 35 |
+
|
| 36 |
+
with gr.Row():
|
| 37 |
+
output_image1 = gr.Image(type="pil", height=height, width=width)
|
| 38 |
+
output_image2 = gr.Image(type="pil", height=height, width=width)
|
| 39 |
+
output_image3 = gr.Image(type="pil", height=height, width=width)
|
| 40 |
+
output_image4 = gr.Image(type="pil", height=height, width=width)
|
| 41 |
+
output_image5 = gr.Image(type="pil", height=height, width=width)
|
| 42 |
+
|
| 43 |
+
inputs = [input_prompt, input_slider, input_checkbox]
|
| 44 |
+
outputs = [output_image1, output_image2, output_image3, output_image4, output_image5]
|
| 45 |
+
|
| 46 |
+
gr.Interface(fn=generate_gradio_images, inputs=inputs, outputs=outputs)
|
| 47 |
+
|
| 48 |
+
return demo
|
| 49 |
|
| 50 |
# Launch the Gradio interface
|
| 51 |
+
demo = gradio_app()
|
| 52 |
+
demo.launch()
|