Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
import torch
|
| 3 |
from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
|
| 4 |
from diffusers.utils import export_to_video
|
|
@@ -12,7 +13,7 @@ def infer(prompt):
|
|
| 12 |
video_frames = pipe(prompt, num_inference_steps=40, height=320, width=576, num_frames=24).frames
|
| 13 |
video_path = export_to_video(video_frames)
|
| 14 |
print(video_path)
|
| 15 |
-
return video_path
|
| 16 |
|
| 17 |
css = """
|
| 18 |
#col-container {max-width: 510px; margin-left: auto; margin-right: auto;}
|
|
@@ -24,23 +25,27 @@ with gr.Blocks(css=css) as demo:
|
|
| 24 |
gr.Markdown(
|
| 25 |
"""
|
| 26 |
<h1 style="text-align: center;">Zeroscope Text-to-Video</h1>
|
| 27 |
-
|
| 28 |
A watermark-free Modelscope-based video model optimized for producing high-quality 16:9 compositions and a smooth video output. <br />
|
| 29 |
-
This zeroscope_v2_576w model was trained using 9,923 clips and 29,769 tagged frames at 24 frames, 576x320 resolution.<br />
|
| 30 |
|
| 31 |
[](https://huggingface.co/spaces/fffiloni/zeroscope?duplicate=true)
|
| 32 |
-
|
| 33 |
"""
|
| 34 |
)
|
| 35 |
|
| 36 |
-
prompt_in = gr.Textbox(label="Prompt", placeholder="Darth Vader is surfing on waves")
|
| 37 |
#inference_steps = gr.Slider(label="Inference Steps", minimum=10, maximum=100, step=1, value=40, interactive=False)
|
| 38 |
submit_btn = gr.Button("Submit")
|
| 39 |
-
video_result = gr.Video(label="Video Output")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
submit_btn.click(fn=infer,
|
| 42 |
inputs=[prompt_in],
|
| 43 |
-
outputs=[video_result])
|
| 44 |
|
| 45 |
demo.queue(max_size=12).launch()
|
| 46 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from share_btn import community_icon_html, loading_icon_html, share_js
|
| 3 |
import torch
|
| 4 |
from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
|
| 5 |
from diffusers.utils import export_to_video
|
|
|
|
| 13 |
video_frames = pipe(prompt, num_inference_steps=40, height=320, width=576, num_frames=24).frames
|
| 14 |
video_path = export_to_video(video_frames)
|
| 15 |
print(video_path)
|
| 16 |
+
return video_path, gr.Group.update(visible=True)
|
| 17 |
|
| 18 |
css = """
|
| 19 |
#col-container {max-width: 510px; margin-left: auto; margin-right: auto;}
|
|
|
|
| 25 |
gr.Markdown(
|
| 26 |
"""
|
| 27 |
<h1 style="text-align: center;">Zeroscope Text-to-Video</h1>
|
| 28 |
+
<p style="text-align: center;">
|
| 29 |
A watermark-free Modelscope-based video model optimized for producing high-quality 16:9 compositions and a smooth video output. <br />
|
|
|
|
| 30 |
|
| 31 |
[](https://huggingface.co/spaces/fffiloni/zeroscope?duplicate=true)
|
| 32 |
+
</p>
|
| 33 |
"""
|
| 34 |
)
|
| 35 |
|
| 36 |
+
prompt_in = gr.Textbox(label="Prompt", placeholder="Darth Vader is surfing on waves", elem_id="prompt-in")
|
| 37 |
#inference_steps = gr.Slider(label="Inference Steps", minimum=10, maximum=100, step=1, value=40, interactive=False)
|
| 38 |
submit_btn = gr.Button("Submit")
|
| 39 |
+
video_result = gr.Video(label="Video Output", elem_id="video-output")
|
| 40 |
+
|
| 41 |
+
with gr.Group(elem_id="share-btn-container", visible=False) as share_group:
|
| 42 |
+
community_icon = gr.HTML(community_icon_html)
|
| 43 |
+
loading_icon = gr.HTML(loading_icon_html)
|
| 44 |
+
share_button = gr.Button("Share to community", elem_id="share-btn")
|
| 45 |
|
| 46 |
submit_btn.click(fn=infer,
|
| 47 |
inputs=[prompt_in],
|
| 48 |
+
outputs=[video_result, share_group])
|
| 49 |
|
| 50 |
demo.queue(max_size=12).launch()
|
| 51 |
|