Spaces:
Sleeping
Sleeping
File size: 2,706 Bytes
41df733 1a4fa2e 41df733 4336d0b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | import os
import gradio as gr
from config import DEFAULT_REGION, FIXED_WIDTH, FIXED_HEIGHT, FIXED_FPS, FIXED_DURATION
from handlers.video_generation_type import generate_single_shot, refresh_listing
with gr.Blocks(title="Nova Reel โ Text โ Video (Single-shot)") as demo:
gr.Markdown(
f"# ๐ฌDEval Nova Reel 1:0 โ Text/Image โ Video\n"
f"**Single-shot only.** Fixed **{FIXED_WIDTH}ร{FIXED_HEIGHT} @ {FIXED_FPS} fps**, duration **{FIXED_DURATION}s**.\n"
"Starts an async job, polls until completion, then downloads `output.mp4` from your S3 path."
)
with gr.Row():
with gr.Column(scale=2):
prompt = gr.Textbox(
label="Prompt",
placeholder="Closeup of a cute old steampunk robot riding a horse. Camera zoom in.",
lines=4,
)
reference_image = gr.Image(
label="Optional reference image (PNG/JPEG, ideally 1280ร720)",
type="filepath",
)
with gr.Column(scale=1):
s3_uri = gr.Textbox(
label="S3 output base URI",
value="s3://bucketvideogenerationwest",
placeholder="s3://your-bucket[/optional/prefix]",
)
region = gr.Textbox(label="AWS Region", value=DEFAULT_REGION)
seed = gr.Textbox(label="Seed (optional)", value="", placeholder="leave blank for random")
custom_name = gr.Textbox(
label="Video name (optional)",
placeholder="Defaults to part of the prompt",
value=""
)
go = gr.Button("๐ Generate")
with gr.Row():
vid = gr.Video(label="Generated Video")
status = gr.Markdown("", elem_id="status")
gr.Markdown("### ๐ผ Videos already in this bucket/prefix")
table = gr.Dataframe(
headers=["Key", "Size (MB)", "Last Modified (UTC)", "S3 URI"],
interactive=False,
wrap=False,
label="Existing .mp4 objects"
)
refresh_btn = gr.Button("๐ Refresh list")
go.click(
fn=generate_single_shot,
inputs=[prompt, s3_uri, seed, region, reference_image, custom_name],
outputs=[vid, status, table],
api_name="generate"
)
refresh_btn.click(
fn=refresh_listing,
inputs=[s3_uri, region],
outputs=[table]
)
s3_uri.change(
fn=refresh_listing,
inputs=[s3_uri, region],
outputs=[table]
)
if __name__ == "__main__":
auth_user = os.getenv("USER")
auth_pass = os.getenv("PASS")
demo.queue().launch(
auth=(auth_user, auth_pass), share=True, ssr_mode=False
) |