Spaces:
Paused
Paused
Update app_gradio.py
Browse files- app_gradio.py +34 -32
app_gradio.py
CHANGED
|
@@ -220,6 +220,28 @@ def create_gradio_interface():
|
|
| 220 |
|
| 221 |
with gr.Row():
|
| 222 |
with gr.Column():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 223 |
|
| 224 |
|
| 225 |
motion_prompt = gr.Textbox(
|
|
@@ -242,40 +264,12 @@ def create_gradio_interface():
|
|
| 242 |
value=0.5,
|
| 243 |
step=0.1,
|
| 244 |
label="Motion Strength"
|
| 245 |
-
)
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
with gr.Tab("Main"):
|
| 249 |
-
input_sketch = gr.Image(
|
| 250 |
-
type="pil",
|
| 251 |
-
label="Selected Sketch",
|
| 252 |
-
scale=1,
|
| 253 |
-
interactive=True,
|
| 254 |
-
height=300 # Fixed height for consistency
|
| 255 |
-
)
|
| 256 |
-
with gr.Tab("Draw"):
|
| 257 |
-
draw_sketchpad = gr.Sketchpad(
|
| 258 |
-
type="pil",
|
| 259 |
-
image_mode="RGB",
|
| 260 |
-
layers=False,
|
| 261 |
-
height=300
|
| 262 |
-
)
|
| 263 |
-
|
| 264 |
-
def load_drawing(im):
|
| 265 |
-
return im["composite"]
|
| 266 |
-
|
| 267 |
-
draw_sketchpad.change(load_drawing, outputs=input_sketch, inputs=draw_sketchpad, show_progress="hidden")
|
| 268 |
|
| 269 |
-
generate_btn = gr.Button(
|
| 270 |
-
"Generate Animation",
|
| 271 |
-
variant="primary",
|
| 272 |
-
elem_classes="generate-btn",
|
| 273 |
-
interactive=True,
|
| 274 |
-
)
|
| 275 |
|
| 276 |
-
|
| 277 |
-
with gr.Column():
|
| 278 |
-
gr.Examples(
|
| 279 |
examples=[
|
| 280 |
['./static/examples/sketch1.png', 'The camel walks slowly'],
|
| 281 |
['./static/examples/sketch2.png', 'The wine in the wine glass sways from side to side'],
|
|
@@ -293,7 +287,15 @@ def create_gradio_interface():
|
|
| 293 |
inputs=[input_sketch, motion_prompt],
|
| 294 |
examples_per_page=4
|
| 295 |
)
|
|
|
|
|
|
|
| 296 |
with gr.Column():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 297 |
output_gallery = gr.Gallery(
|
| 298 |
label="Results",
|
| 299 |
elem_classes="output-gallery",
|
|
|
|
| 220 |
|
| 221 |
with gr.Row():
|
| 222 |
with gr.Column():
|
| 223 |
+
|
| 224 |
+
with gr.Tab("Main"):
|
| 225 |
+
input_sketch = gr.Image(
|
| 226 |
+
type="pil",
|
| 227 |
+
label="Selected Sketch",
|
| 228 |
+
scale=1,
|
| 229 |
+
interactive=True,
|
| 230 |
+
height=300 # Fixed height for consistency
|
| 231 |
+
)
|
| 232 |
+
with gr.Tab("Draw"):
|
| 233 |
+
draw_sketchpad = gr.Sketchpad(
|
| 234 |
+
value=[{"background": "./static/examples/background.jpeg"}],
|
| 235 |
+
type="pil",
|
| 236 |
+
image_mode="RGB",
|
| 237 |
+
layers=False,
|
| 238 |
+
height=300
|
| 239 |
+
)
|
| 240 |
+
|
| 241 |
+
def load_drawing(im):
|
| 242 |
+
return im["composite"]
|
| 243 |
+
|
| 244 |
+
draw_sketchpad.change(load_drawing, outputs=input_sketch, inputs=draw_sketchpad, show_progress="hidden")
|
| 245 |
|
| 246 |
|
| 247 |
motion_prompt = gr.Textbox(
|
|
|
|
| 264 |
value=0.5,
|
| 265 |
step=0.1,
|
| 266 |
label="Motion Strength"
|
| 267 |
+
)
|
| 268 |
+
|
| 269 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 270 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 271 |
|
| 272 |
+
gr.Examples(
|
|
|
|
|
|
|
| 273 |
examples=[
|
| 274 |
['./static/examples/sketch1.png', 'The camel walks slowly'],
|
| 275 |
['./static/examples/sketch2.png', 'The wine in the wine glass sways from side to side'],
|
|
|
|
| 287 |
inputs=[input_sketch, motion_prompt],
|
| 288 |
examples_per_page=4
|
| 289 |
)
|
| 290 |
+
|
| 291 |
+
|
| 292 |
with gr.Column():
|
| 293 |
+
generate_btn = gr.Button(
|
| 294 |
+
"Generate Animation",
|
| 295 |
+
variant="primary",
|
| 296 |
+
elem_classes="generate-btn",
|
| 297 |
+
interactive=True,
|
| 298 |
+
)
|
| 299 |
output_gallery = gr.Gallery(
|
| 300 |
label="Results",
|
| 301 |
elem_classes="output-gallery",
|