Spaces:
Runtime error
Runtime error
Commit
•
b2a6e83
1
Parent(s):
4254e9c
Update app.py
Browse files
app.py
CHANGED
@@ -101,39 +101,12 @@ def generate_video(prompt, image=None, duration=5, guidance_scale=9, video_guida
|
|
101 |
export_to_video(frames, output_path, fps=8)
|
102 |
return output_path
|
103 |
|
104 |
-
# Image-to-video generation function
|
105 |
-
#@spaces.GPU(duration=240)
|
106 |
-
#def generate_video_from_image(image, prompt, duration, video_guidance_scale):
|
107 |
-
# temp = int(duration * 2.4) # Convert seconds to temp value (assuming 24 FPS)
|
108 |
-
# torch_dtype = torch.bfloat16 if MODEL_DTYPE == "bf16" else torch.float32
|
109 |
-
#
|
110 |
-
# target_size = (1280, 720)
|
111 |
-
# cropped_image = center_crop(image, 1280, 720)
|
112 |
-
# resized_image = cropped_image.resize((1280, 720))
|
113 |
-
#
|
114 |
-
# with torch.no_grad(), torch.cuda.amp.autocast(enabled=True, dtype=torch_dtype):
|
115 |
-
# frames = model.generate_i2v(
|
116 |
-
# prompt=prompt,
|
117 |
-
# input_image=resized_image,
|
118 |
-
# num_inference_steps=[10, 10, 10],
|
119 |
-
# temp=temp,
|
120 |
-
# guidance_scale=7.0,
|
121 |
-
# video_guidance_scale=video_guidance_scale,
|
122 |
-
# output_type="pil",
|
123 |
-
# save_memory=True,
|
124 |
-
# )
|
125 |
-
|
126 |
-
output_path = "output_video_i2v.mp4"
|
127 |
-
export_to_video(frames, output_path, fps=24)
|
128 |
-
return output_path
|
129 |
-
|
130 |
# Gradio interface
|
131 |
with gr.Blocks() as demo:
|
132 |
gr.Markdown("# Pyramid Flow")
|
133 |
gr.Markdown("Pyramid Flow is a training-efficient Autoregressive Video Generation model based on Flow Matching. It is trained only on open-source datasets within 20.7k A100 GPU hours")
|
134 |
gr.Markdown("[[Paper](https://arxiv.org/pdf/2410.05954)], [[Model](https://huggingface.co/rain1011/pyramid-flow-sd3)], [[Code](https://github.com/jy0205/Pyramid-Flow)]")
|
135 |
|
136 |
-
#with gr.Tab("Text-to-Video"):
|
137 |
with gr.Row():
|
138 |
with gr.Column():
|
139 |
with gr.Accordion("Image to Video (optional)", open=False):
|
@@ -171,22 +144,5 @@ with gr.Blocks() as demo:
|
|
171 |
inputs=[t2v_prompt, i2v_image, t2v_duration, t2v_guidance_scale, t2v_video_guidance_scale],
|
172 |
outputs=t2v_output
|
173 |
)
|
174 |
-
|
175 |
-
#with gr.Tab("Image-to-Video"):
|
176 |
-
# with gr.Row():
|
177 |
-
# with gr.Column():
|
178 |
-
|
179 |
-
# i2v_prompt = gr.Textbox(label="Prompt")
|
180 |
-
# i2v_duration = gr.Slider(minimum=1, maximum=10, value=5, step=1, label="Duration (seconds)")
|
181 |
-
# i2v_video_guidance_scale = gr.Slider(minimum=1, maximum=15, value=4, step=0.1, label="Video Guidance Scale")
|
182 |
-
# i2v_generate_btn = gr.Button("Generate Video")
|
183 |
-
# with gr.Column():
|
184 |
-
# i2v_output = gr.Video(label="Generated Video")
|
185 |
-
|
186 |
-
#i2v_generate_btn.click(
|
187 |
-
# generate_video_from_image,
|
188 |
-
# inputs=[i2v_image, i2v_prompt, i2v_duration, i2v_video_guidance_scale],
|
189 |
-
# outputs=i2v_output
|
190 |
-
#)
|
191 |
|
192 |
demo.launch()
|
|
|
101 |
export_to_video(frames, output_path, fps=8)
|
102 |
return output_path
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
# Gradio interface
|
105 |
with gr.Blocks() as demo:
|
106 |
gr.Markdown("# Pyramid Flow")
|
107 |
gr.Markdown("Pyramid Flow is a training-efficient Autoregressive Video Generation model based on Flow Matching. It is trained only on open-source datasets within 20.7k A100 GPU hours")
|
108 |
gr.Markdown("[[Paper](https://arxiv.org/pdf/2410.05954)], [[Model](https://huggingface.co/rain1011/pyramid-flow-sd3)], [[Code](https://github.com/jy0205/Pyramid-Flow)]")
|
109 |
|
|
|
110 |
with gr.Row():
|
111 |
with gr.Column():
|
112 |
with gr.Accordion("Image to Video (optional)", open=False):
|
|
|
144 |
inputs=[t2v_prompt, i2v_image, t2v_duration, t2v_guidance_scale, t2v_video_guidance_scale],
|
145 |
outputs=t2v_output
|
146 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
|
148 |
demo.launch()
|