Spaces:
Paused
Paused
alex
commited on
Commit
·
f0b3778
1
Parent(s):
6a5bfe2
guidance
Browse files
app.py
CHANGED
|
@@ -46,11 +46,11 @@ W, H = 512, 320 # the code calls pipeline with width=512, height=320
|
|
| 46 |
# --------- action types ----------
|
| 47 |
# Display labels mapped to integer IDs
|
| 48 |
ACTION_TYPES = {
|
| 49 |
-
"
|
| 50 |
-
"
|
| 51 |
-
"
|
| 52 |
-
"
|
| 53 |
-
"
|
| 54 |
}
|
| 55 |
|
| 56 |
# --------- helpers ----------
|
|
@@ -137,7 +137,7 @@ def make_sample(
|
|
| 137 |
}
|
| 138 |
return sample
|
| 139 |
|
| 140 |
-
g_use_factor_guidance =
|
| 141 |
|
| 142 |
pipe = load_ctrlv_pipelines(
|
| 143 |
"AnthonyGosselin/Ctrl-Crash",
|
|
@@ -345,41 +345,47 @@ with gr.Blocks(title="Ctrl-Crash Demo") as demo:
|
|
| 345 |
gr.Markdown("# Ctrl-Crash: Image → Conditioned Video")
|
| 346 |
with gr.Row():
|
| 347 |
with gr.Column(scale=1):
|
| 348 |
-
video_in = gr.Video(label="
|
| 349 |
|
| 350 |
action_dropdown = gr.Dropdown(
|
| 351 |
label="Action Type",
|
| 352 |
choices=list(ACTION_TYPES.keys()),
|
| 353 |
-
value="
|
| 354 |
)
|
| 355 |
bbx_frames = gr.Slider(1, 25, value=3, step=1, label="Frames")
|
| 356 |
run_btn = gr.Button("Generate Video", variant="primary")
|
| 357 |
with gr.Column(scale=1):
|
| 358 |
-
video_out = gr.Video(label="Output video
|
| 359 |
|
| 360 |
cached_examples = gr.Examples(
|
| 361 |
examples=[
|
| 362 |
[
|
| 363 |
"examples/gt_video.mp4",
|
| 364 |
-
"
|
| 365 |
3,
|
| 366 |
],
|
| 367 |
|
| 368 |
[
|
| 369 |
"examples/gt_video.mp4",
|
| 370 |
-
"
|
| 371 |
3,
|
| 372 |
],
|
| 373 |
|
| 374 |
[
|
| 375 |
"examples/gt_video.mp4",
|
| 376 |
-
"
|
| 377 |
3,
|
| 378 |
],
|
| 379 |
|
| 380 |
[
|
| 381 |
"examples/gt_video.mp4",
|
| 382 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 383 |
3,
|
| 384 |
],
|
| 385 |
|
|
|
|
| 46 |
# --------- action types ----------
|
| 47 |
# Display labels mapped to integer IDs
|
| 48 |
ACTION_TYPES = {
|
| 49 |
+
"No Crash": 0,
|
| 50 |
+
"Ego-Only crash": 1,
|
| 51 |
+
"Ego-and-Vehicle crash": 2,
|
| 52 |
+
"Vehicle-Only crash": 3,
|
| 53 |
+
"Vehicle-and-Vehicle crash": 4,
|
| 54 |
}
|
| 55 |
|
| 56 |
# --------- helpers ----------
|
|
|
|
| 137 |
}
|
| 138 |
return sample
|
| 139 |
|
| 140 |
+
g_use_factor_guidance = False
|
| 141 |
|
| 142 |
pipe = load_ctrlv_pipelines(
|
| 143 |
"AnthonyGosselin/Ctrl-Crash",
|
|
|
|
| 345 |
gr.Markdown("# Ctrl-Crash: Image → Conditioned Video")
|
| 346 |
with gr.Row():
|
| 347 |
with gr.Column(scale=1):
|
| 348 |
+
video_in = gr.Video(label="Dashcam Footage")
|
| 349 |
|
| 350 |
action_dropdown = gr.Dropdown(
|
| 351 |
label="Action Type",
|
| 352 |
choices=list(ACTION_TYPES.keys()),
|
| 353 |
+
value="Vehicle-and-Vehicle crash", # sensible default matching your prior checkbox default
|
| 354 |
)
|
| 355 |
bbx_frames = gr.Slider(1, 25, value=3, step=1, label="Frames")
|
| 356 |
run_btn = gr.Button("Generate Video", variant="primary")
|
| 357 |
with gr.Column(scale=1):
|
| 358 |
+
video_out = gr.Video(label="Output video")
|
| 359 |
|
| 360 |
cached_examples = gr.Examples(
|
| 361 |
examples=[
|
| 362 |
[
|
| 363 |
"examples/gt_video.mp4",
|
| 364 |
+
"No Crash",
|
| 365 |
3,
|
| 366 |
],
|
| 367 |
|
| 368 |
[
|
| 369 |
"examples/gt_video.mp4",
|
| 370 |
+
"Ego-Only crash",
|
| 371 |
3,
|
| 372 |
],
|
| 373 |
|
| 374 |
[
|
| 375 |
"examples/gt_video.mp4",
|
| 376 |
+
"Ego-and-Vehicle crash",
|
| 377 |
3,
|
| 378 |
],
|
| 379 |
|
| 380 |
[
|
| 381 |
"examples/gt_video.mp4",
|
| 382 |
+
"Vehicle-Only crash",
|
| 383 |
+
3,
|
| 384 |
+
],
|
| 385 |
+
|
| 386 |
+
[
|
| 387 |
+
"examples/gt_video.mp4",
|
| 388 |
+
"Vehicle-and-Vehicle crash",
|
| 389 |
3,
|
| 390 |
],
|
| 391 |
|