Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,8 +9,8 @@ pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
|
|
9 |
pipe.enable_model_cpu_offload()
|
10 |
|
11 |
def infer(prompt):
|
12 |
-
|
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)
|
@@ -78,6 +78,26 @@ img[src*='#center'] {
|
|
78 |
display: block;
|
79 |
margin: auto;
|
80 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
"""
|
82 |
|
83 |
with gr.Blocks(css=css) as demo:
|
@@ -95,6 +115,7 @@ with gr.Blocks(css=css) as demo:
|
|
95 |
)
|
96 |
|
97 |
prompt_in = gr.Textbox(label="Prompt", placeholder="Darth Vader is surfing on waves", elem_id="prompt-in")
|
|
|
98 |
#inference_steps = gr.Slider(label="Inference Steps", minimum=10, maximum=100, step=1, value=40, interactive=False)
|
99 |
submit_btn = gr.Button("Submit")
|
100 |
video_result = gr.Video(label="Video Output", elem_id="video-output")
|
@@ -104,6 +125,25 @@ with gr.Blocks(css=css) as demo:
|
|
104 |
loading_icon = gr.HTML(loading_icon_html)
|
105 |
share_button = gr.Button("Share to community", elem_id="share-btn")
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
submit_btn.click(fn=infer,
|
108 |
inputs=[prompt_in],
|
109 |
outputs=[video_result, share_group])
|
|
|
9 |
pipe.enable_model_cpu_offload()
|
10 |
|
11 |
def infer(prompt):
|
12 |
+
negative_prompt = "text, watermark, copyright, blurry, nsfw"
|
13 |
+
video_frames = pipe(prompt, negative_prompt=negative_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)
|
|
|
78 |
display: block;
|
79 |
margin: auto;
|
80 |
}
|
81 |
+
|
82 |
+
.footer {
|
83 |
+
margin-bottom: 45px;
|
84 |
+
margin-top: 10px;
|
85 |
+
text-align: center;
|
86 |
+
border-bottom: 1px solid #e5e5e5;
|
87 |
+
}
|
88 |
+
.footer>p {
|
89 |
+
font-size: .8rem;
|
90 |
+
display: inline-block;
|
91 |
+
padding: 0 10px;
|
92 |
+
transform: translateY(10px);
|
93 |
+
background: white;
|
94 |
+
}
|
95 |
+
.dark .footer {
|
96 |
+
border-color: #303030;
|
97 |
+
}
|
98 |
+
.dark .footer>p {
|
99 |
+
background: #0b0f19;
|
100 |
+
}
|
101 |
"""
|
102 |
|
103 |
with gr.Blocks(css=css) as demo:
|
|
|
115 |
)
|
116 |
|
117 |
prompt_in = gr.Textbox(label="Prompt", placeholder="Darth Vader is surfing on waves", elem_id="prompt-in")
|
118 |
+
#neg_prompt = gr.Textbox(label="Negative prompt", value="text, watermark, copyright, blurry, nsfw", elem_id="neg-prompt-in")
|
119 |
#inference_steps = gr.Slider(label="Inference Steps", minimum=10, maximum=100, step=1, value=40, interactive=False)
|
120 |
submit_btn = gr.Button("Submit")
|
121 |
video_result = gr.Video(label="Video Output", elem_id="video-output")
|
|
|
125 |
loading_icon = gr.HTML(loading_icon_html)
|
126 |
share_button = gr.Button("Share to community", elem_id="share-btn")
|
127 |
|
128 |
+
gr.HTML("""
|
129 |
+
<div class="footer">
|
130 |
+
<p>
|
131 |
+
<a href="https://huggingface.co/cerspense/zeroscope_v2_576w" target="_blank">Zeroscope v2 576w</a> by @cerspence -
|
132 |
+
Demo by 🤗 <a href="https://twitter.com/fffiloni" target="_blank">Sylvain Filoni</a>
|
133 |
+
</p>
|
134 |
+
</div>
|
135 |
+
<div id="may-like-container" style="display: flex;justify-content: center;flex-direction: column;align-items: center;">
|
136 |
+
<p style="font-size: 0.8em;margin-bottom: 4px;">You may also like: </p>
|
137 |
+
<div id="may-like" style="display:flex; align-items:center; justify-content: center;height:20px;">
|
138 |
+
<svg height="20" width="148" style="margin-left:4px">
|
139 |
+
<a href="https://huggingface.co/spaces/fffiloni/zeroscope-XL" target="_blank">
|
140 |
+
<image href="https://img.shields.io/badge/🤗 Spaces-Zeroscope XL-blue" src="https://img.shields.io/badge/🤗 Spaces-Image to Music-blue.png" height="20"/>
|
141 |
+
</a>
|
142 |
+
</svg>
|
143 |
+
</div>
|
144 |
+
</div>
|
145 |
+
""")
|
146 |
+
|
147 |
submit_btn.click(fn=infer,
|
148 |
inputs=[prompt_in],
|
149 |
outputs=[video_result, share_group])
|