Spaces:
Sleeping
Sleeping
Update app_gradio.py
Browse files- app_gradio.py +38 -37
app_gradio.py
CHANGED
|
@@ -220,33 +220,29 @@ def create_gradio_interface():
|
|
| 220 |
|
| 221 |
with gr.Row():
|
| 222 |
with gr.Column():
|
| 223 |
-
|
| 224 |
-
input_sketch = gr.Image(
|
| 225 |
-
type="pil",
|
| 226 |
-
label="Selected Sketch",
|
| 227 |
-
scale=1,
|
| 228 |
-
interactive=True,
|
| 229 |
-
height=300 # Fixed height for consistency
|
| 230 |
-
)
|
| 231 |
-
with gr.Tab("Draw"):
|
| 232 |
-
draw_sketchpad = gr.Sketchpad(
|
| 233 |
-
type="pil",
|
| 234 |
-
sources=["upload"],
|
| 235 |
-
image_mode="L",
|
| 236 |
-
layers=False,
|
| 237 |
-
height=300
|
| 238 |
-
)
|
| 239 |
-
|
| 240 |
-
def load_drawing(im):
|
| 241 |
-
return im["composite"]
|
| 242 |
-
|
| 243 |
-
draw_sketchpad.change(load_drawing, outputs=input_sketch, inputs=draw_sketchpad, show_progress="hidden")
|
| 244 |
|
| 245 |
motion_prompt = gr.Textbox(
|
| 246 |
label="Prompt",
|
| 247 |
placeholder="Describe the motion...",
|
| 248 |
lines=3
|
| 249 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 250 |
|
| 251 |
gr.Examples(
|
| 252 |
examples=[
|
|
@@ -264,24 +260,31 @@ def create_gradio_interface():
|
|
| 264 |
['./static/examples/sketch12.png', 'The biker rides on the road']
|
| 265 |
],
|
| 266 |
inputs=[input_sketch, motion_prompt],
|
| 267 |
-
examples_per_page=
|
| 268 |
)
|
| 269 |
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
|
|
|
| 277 |
)
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 285 |
generate_btn = gr.Button(
|
| 286 |
"Generate Animation",
|
| 287 |
variant="primary",
|
|
@@ -289,8 +292,6 @@ def create_gradio_interface():
|
|
| 289 |
interactive=True,
|
| 290 |
)
|
| 291 |
|
| 292 |
-
with gr.Column():
|
| 293 |
-
|
| 294 |
output_gallery = gr.Gallery(
|
| 295 |
label="Results",
|
| 296 |
elem_classes="output-gallery",
|
|
|
|
| 220 |
|
| 221 |
with gr.Row():
|
| 222 |
with gr.Column():
|
| 223 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
|
| 225 |
motion_prompt = gr.Textbox(
|
| 226 |
label="Prompt",
|
| 227 |
placeholder="Describe the motion...",
|
| 228 |
lines=3
|
| 229 |
)
|
| 230 |
+
|
| 231 |
+
with gr.Row():
|
| 232 |
+
num_seeds = gr.Slider(
|
| 233 |
+
minimum=1,
|
| 234 |
+
maximum=10,
|
| 235 |
+
value=5,
|
| 236 |
+
step=1,
|
| 237 |
+
label="Seeds"
|
| 238 |
+
)
|
| 239 |
+
lambda_ = gr.Slider(
|
| 240 |
+
minimum=0,
|
| 241 |
+
maximum=1,
|
| 242 |
+
value=0.5,
|
| 243 |
+
step=0.1,
|
| 244 |
+
label="Motion Strength"
|
| 245 |
+
)
|
| 246 |
|
| 247 |
gr.Examples(
|
| 248 |
examples=[
|
|
|
|
| 260 |
['./static/examples/sketch12.png', 'The biker rides on the road']
|
| 261 |
],
|
| 262 |
inputs=[input_sketch, motion_prompt],
|
| 263 |
+
examples_per_page=4
|
| 264 |
)
|
| 265 |
|
| 266 |
+
with gr.Column():
|
| 267 |
+
with gr.Tab("Main"):
|
| 268 |
+
input_sketch = gr.Image(
|
| 269 |
+
type="pil",
|
| 270 |
+
label="Selected Sketch",
|
| 271 |
+
scale=1,
|
| 272 |
+
interactive=True,
|
| 273 |
+
height=300 # Fixed height for consistency
|
| 274 |
)
|
| 275 |
+
with gr.Tab("Draw"):
|
| 276 |
+
draw_sketchpad = gr.Sketchpad(
|
| 277 |
+
type="pil",
|
| 278 |
+
image_mode="RGB",
|
| 279 |
+
layers=False,
|
| 280 |
+
height=300
|
| 281 |
)
|
| 282 |
+
|
| 283 |
+
def load_drawing(im):
|
| 284 |
+
return im["composite"]
|
| 285 |
+
|
| 286 |
+
draw_sketchpad.change(load_drawing, outputs=input_sketch, inputs=draw_sketchpad, show_progress="hidden")
|
| 287 |
+
|
| 288 |
generate_btn = gr.Button(
|
| 289 |
"Generate Animation",
|
| 290 |
variant="primary",
|
|
|
|
| 292 |
interactive=True,
|
| 293 |
)
|
| 294 |
|
|
|
|
|
|
|
| 295 |
output_gallery = gr.Gallery(
|
| 296 |
label="Results",
|
| 297 |
elem_classes="output-gallery",
|