Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,11 +10,17 @@ bench = ds.load_dataset(
|
|
| 10 |
bench = bench.cast_column("video", ds.Video(decode=False))
|
| 11 |
num_videos = len(bench)
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
with gr.Blocks() as demo:
|
| 14 |
header = gr.Markdown(
|
| 15 |
"""
|
| 16 |
-
# Goku MovieGen Bench Video Explorer
|
| 17 |
-
Use this interface to view videos generated by [Goku](https://saiyan-world.github.io/goku/). For more information, see [Goku: Flow Based Video Generate Models on arXiv](https://arxiv.org/abs/2502.04896). """.strip()
|
| 18 |
)
|
| 19 |
video = gr.Video(
|
| 20 |
value=bench[0]["video"]["path"],
|
|
@@ -24,36 +30,39 @@ with gr.Blocks() as demo:
|
|
| 24 |
|
| 25 |
dropdown = gr.Dropdown(
|
| 26 |
label="Video",
|
| 27 |
-
choices=
|
| 28 |
-
value=0
|
| 29 |
)
|
| 30 |
|
| 31 |
-
def set_video(
|
|
|
|
| 32 |
return gr.Video(
|
| 33 |
value=bench[new_id]["video"]["path"],
|
| 34 |
loop=True,
|
| 35 |
autoplay=True,
|
| 36 |
)
|
| 37 |
|
| 38 |
-
def decrement(
|
|
|
|
| 39 |
return gr.Dropdown(
|
| 40 |
label="Video",
|
| 41 |
-
choices=
|
| 42 |
-
value=max(0, current_id-1)
|
| 43 |
)
|
| 44 |
|
| 45 |
-
def increment(
|
|
|
|
| 46 |
return gr.Dropdown(
|
| 47 |
label="Video",
|
| 48 |
-
choices=
|
| 49 |
-
value=min(num_videos-1, current_id+1)
|
| 50 |
)
|
| 51 |
|
| 52 |
def random_video():
|
| 53 |
return gr.Dropdown(
|
| 54 |
label="Video",
|
| 55 |
-
choices=
|
| 56 |
-
value=random.randint(0, num_videos-1)
|
| 57 |
)
|
| 58 |
|
| 59 |
with gr.Row():
|
|
|
|
| 10 |
bench = bench.cast_column("video", ds.Video(decode=False))
|
| 11 |
num_videos = len(bench)
|
| 12 |
|
| 13 |
+
prompts = ds.load_dataset(
|
| 14 |
+
"meta-ai-for-media-research/movie_gen_video_bench",
|
| 15 |
+
split="test"
|
| 16 |
+
)
|
| 17 |
+
prompts = [p["prompt"] for p in prompts][:num_videos]
|
| 18 |
+
|
| 19 |
with gr.Blocks() as demo:
|
| 20 |
header = gr.Markdown(
|
| 21 |
"""
|
| 22 |
+
# Goku MovieGen Video Bench Video Explorer
|
| 23 |
+
Use this interface to view videos generated by [Goku](https://saiyan-world.github.io/goku/) using the promps from [Meta AI's MovieGen Video Bench](https://huggingface.co/datasets/meta-ai-for-media-research/movie_gen_video_bench). For more information, see [Goku: Flow Based Video Generate Models on arXiv](https://arxiv.org/abs/2502.04896). """.strip()
|
| 24 |
)
|
| 25 |
video = gr.Video(
|
| 26 |
value=bench[0]["video"]["path"],
|
|
|
|
| 30 |
|
| 31 |
dropdown = gr.Dropdown(
|
| 32 |
label="Video",
|
| 33 |
+
choices=prompts,
|
| 34 |
+
value=prompts[0]
|
| 35 |
)
|
| 36 |
|
| 37 |
+
def set_video(new_prompt):
|
| 38 |
+
new_id = prompts.find(new_prompt)
|
| 39 |
return gr.Video(
|
| 40 |
value=bench[new_id]["video"]["path"],
|
| 41 |
loop=True,
|
| 42 |
autoplay=True,
|
| 43 |
)
|
| 44 |
|
| 45 |
+
def decrement(current_prompt):
|
| 46 |
+
current_id = prompts.find(current_prompt)
|
| 47 |
return gr.Dropdown(
|
| 48 |
label="Video",
|
| 49 |
+
choices=prompts,
|
| 50 |
+
value=prompts[max(0, current_id-1)]
|
| 51 |
)
|
| 52 |
|
| 53 |
+
def increment(current_prompt):
|
| 54 |
+
current_id = prompts.find(current_prompt)
|
| 55 |
return gr.Dropdown(
|
| 56 |
label="Video",
|
| 57 |
+
choices=prompts,
|
| 58 |
+
value=prompts[min(num_videos-1, current_id+1)]
|
| 59 |
)
|
| 60 |
|
| 61 |
def random_video():
|
| 62 |
return gr.Dropdown(
|
| 63 |
label="Video",
|
| 64 |
+
choices=prompts,
|
| 65 |
+
value=prompts[random.randint(0, num_videos-1)]
|
| 66 |
)
|
| 67 |
|
| 68 |
with gr.Row():
|