Spaces:
Running
on
Zero
Running
on
Zero
Martim-Ramos-Neural
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -67,24 +67,19 @@ def generate_image(prompt, base="Realistic", motion="", step=8, resolution="Squa
|
|
67 |
pipe.set_adapters(["motion"], [0.7])
|
68 |
motion_loaded = motion
|
69 |
|
70 |
-
# Ensure num_frames aligns with the model's requirements
|
71 |
-
fps = 10
|
72 |
-
max_frames = 32 # Adjust based on model specs
|
73 |
-
num_frames = min((duration * fps) // max_frames * max_frames, max_frames)
|
74 |
-
|
75 |
progress((0, step))
|
76 |
def progress_callback(i, t, z):
|
77 |
-
progress((i
|
78 |
|
|
|
79 |
output = pipe(prompt=prompt, guidance_scale=1.2, num_inference_steps=step, width=width, height=height, num_frames=num_frames, callback=progress_callback, callback_steps=1)
|
80 |
|
81 |
name = str(uuid.uuid4()).replace("-", "")
|
82 |
path = f"/tmp/{name}.mp4"
|
83 |
-
export_to_video(output.frames, path, fps=
|
84 |
return path
|
85 |
|
86 |
|
87 |
-
|
88 |
# Gradio Interface
|
89 |
with gr.Blocks(css="style.css") as demo:
|
90 |
gr.HTML(
|
|
|
67 |
pipe.set_adapters(["motion"], [0.7])
|
68 |
motion_loaded = motion
|
69 |
|
|
|
|
|
|
|
|
|
|
|
70 |
progress((0, step))
|
71 |
def progress_callback(i, t, z):
|
72 |
+
progress((i+1, step))
|
73 |
|
74 |
+
num_frames = duration * 10 # Assuming 10 FPS
|
75 |
output = pipe(prompt=prompt, guidance_scale=1.2, num_inference_steps=step, width=width, height=height, num_frames=num_frames, callback=progress_callback, callback_steps=1)
|
76 |
|
77 |
name = str(uuid.uuid4()).replace("-", "")
|
78 |
path = f"/tmp/{name}.mp4"
|
79 |
+
export_to_video(output.frames, path, fps=10) # Export all frames to video
|
80 |
return path
|
81 |
|
82 |
|
|
|
83 |
# Gradio Interface
|
84 |
with gr.Blocks(css="style.css") as demo:
|
85 |
gr.HTML(
|