Spaces:
Running
Running
update demo only working on duplicated spaces
Browse files
app_df.py
CHANGED
@@ -12,10 +12,10 @@ from skyreels_v2_infer.modules import download_model
|
|
12 |
from skyreels_v2_infer.pipelines import PromptEnhancer, resizecrop
|
13 |
|
14 |
is_shared_ui = True if "fffiloni/SkyReels-V2" in os.environ['SPACE_ID'] else False
|
15 |
-
|
16 |
|
17 |
model_id = None
|
18 |
-
if is_shared_ui:
|
19 |
model_id = download_model("Skywork/SkyReels-V2-DF-1.3B-540P")
|
20 |
|
21 |
def generate_diffusion_forced_video(
|
@@ -156,7 +156,66 @@ if is_shared_ui is True:
|
|
156 |
else:
|
157 |
length_options = ["4", "10", "15", "30", "60"]
|
158 |
|
159 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
with gr.Column():
|
161 |
gr.Markdown("# SkyReels V2: Infinite-Length Film Generation")
|
162 |
gr.Markdown("The first open-source video generative model employing AutoRegressive Diffusion-Forcing architecture that achieves the SOTA performance among publicly available models.")
|
@@ -211,10 +270,51 @@ with gr.Blocks() as demo:
|
|
211 |
teacache_thresh = gr.Slider(minimum=0.0, maximum=1.0, value=0.2, step=0.01, label="TeaCache Threshold")
|
212 |
use_ret_steps = gr.Checkbox(label="Use Retention Steps", value=True)
|
213 |
|
214 |
-
submit_btn = gr.Button("Generate")
|
215 |
|
216 |
with gr.Column():
|
217 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
output_video = gr.Video(label="Generated Video")
|
219 |
|
220 |
gr.Examples(
|
|
|
12 |
from skyreels_v2_infer.pipelines import PromptEnhancer, resizecrop
|
13 |
|
14 |
is_shared_ui = True if "fffiloni/SkyReels-V2" in os.environ['SPACE_ID'] else False
|
15 |
+
is_gpu_associated = torch.cuda.is_available()
|
16 |
|
17 |
model_id = None
|
18 |
+
if not is_shared_ui:
|
19 |
model_id = download_model("Skywork/SkyReels-V2-DF-1.3B-540P")
|
20 |
|
21 |
def generate_diffusion_forced_video(
|
|
|
156 |
else:
|
157 |
length_options = ["4", "10", "15", "30", "60"]
|
158 |
|
159 |
+
css = """
|
160 |
+
div#warning-duplicate {
|
161 |
+
background-color: #ebf5ff;
|
162 |
+
padding: 0 16px 16px;
|
163 |
+
margin: 20px 0;
|
164 |
+
color: #030303!important;
|
165 |
+
}
|
166 |
+
div#warning-duplicate > .gr-prose > h2, div#warning-duplicate > .gr-prose > p {
|
167 |
+
color: #0f4592!important;
|
168 |
+
}
|
169 |
+
div#warning-duplicate strong {
|
170 |
+
color: #0f4592;
|
171 |
+
}
|
172 |
+
p.actions {
|
173 |
+
display: flex;
|
174 |
+
align-items: center;
|
175 |
+
margin: 20px 0;
|
176 |
+
}
|
177 |
+
div#warning-duplicate .actions a {
|
178 |
+
display: inline-block;
|
179 |
+
margin-right: 10px;
|
180 |
+
}
|
181 |
+
div#warning-setgpu {
|
182 |
+
background-color: #fff4eb;
|
183 |
+
padding: 0 16px 16px;
|
184 |
+
margin: 20px 0;
|
185 |
+
color: #030303!important;
|
186 |
+
}
|
187 |
+
div#warning-setgpu > .gr-prose > h2, div#warning-setgpu > .gr-prose > p {
|
188 |
+
color: #92220f!important;
|
189 |
+
}
|
190 |
+
div#warning-setgpu a, div#warning-setgpu b {
|
191 |
+
color: #91230f;
|
192 |
+
}
|
193 |
+
div#warning-setgpu p.actions > a {
|
194 |
+
display: inline-block;
|
195 |
+
background: #1f1f23;
|
196 |
+
border-radius: 40px;
|
197 |
+
padding: 6px 24px;
|
198 |
+
color: antiquewhite;
|
199 |
+
text-decoration: none;
|
200 |
+
font-weight: 600;
|
201 |
+
font-size: 1.2em;
|
202 |
+
}
|
203 |
+
div#warning-ready {
|
204 |
+
background-color: #ecfdf5;
|
205 |
+
padding: 0 16px 16px;
|
206 |
+
margin: 20px 0;
|
207 |
+
color: #030303!important;
|
208 |
+
}
|
209 |
+
div#warning-ready > .gr-prose > h2, div#warning-ready > .gr-prose > p {
|
210 |
+
color: #057857!important;
|
211 |
+
}
|
212 |
+
.custom-color {
|
213 |
+
color: #030303 !important;
|
214 |
+
}
|
215 |
+
"""
|
216 |
+
|
217 |
+
|
218 |
+
with gr.Blocks(css=css) as demo:
|
219 |
with gr.Column():
|
220 |
gr.Markdown("# SkyReels V2: Infinite-Length Film Generation")
|
221 |
gr.Markdown("The first open-source video generative model employing AutoRegressive Diffusion-Forcing architecture that achieves the SOTA performance among publicly available models.")
|
|
|
270 |
teacache_thresh = gr.Slider(minimum=0.0, maximum=1.0, value=0.2, step=0.01, label="TeaCache Threshold")
|
271 |
use_ret_steps = gr.Checkbox(label="Use Retention Steps", value=True)
|
272 |
|
273 |
+
submit_btn = gr.Button("Generate", interactive=False if is_shared_ui else True)
|
274 |
|
275 |
with gr.Column():
|
276 |
|
277 |
+
if is_shared_ui:
|
278 |
+
top_description = gr.HTML(f'''
|
279 |
+
<div class="gr-prose">
|
280 |
+
<h2 class="custom-color"><svg xmlns="http://www.w3.org/2000/svg" width="18px" height="18px" style="margin-right: 0px;display: inline-block;"fill="none"><path fill="#fff" d="M7 13.2a6.3 6.3 0 0 0 4.4-10.7A6.3 6.3 0 0 0 .6 6.9 6.3 6.3 0 0 0 7 13.2Z"/><path fill="#fff" fill-rule="evenodd" d="M7 0a6.9 6.9 0 0 1 4.8 11.8A6.9 6.9 0 0 1 0 7 6.9 6.9 0 0 1 7 0Zm0 0v.7V0ZM0 7h.6H0Zm7 6.8v-.6.6ZM13.7 7h-.6.6ZM9.1 1.7c-.7-.3-1.4-.4-2.2-.4a5.6 5.6 0 0 0-4 1.6 5.6 5.6 0 0 0-1.6 4 5.6 5.6 0 0 0 1.6 4 5.6 5.6 0 0 0 4 1.7 5.6 5.6 0 0 0 4-1.7 5.6 5.6 0 0 0 1.7-4 5.6 5.6 0 0 0-1.7-4c-.5-.5-1.1-.9-1.8-1.2Z" clip-rule="evenodd"/><path fill="#000" fill-rule="evenodd" d="M7 2.9a.8.8 0 1 1 0 1.5A.8.8 0 0 1 7 3ZM5.8 5.7c0-.4.3-.6.6-.6h.7c.3 0 .6.2.6.6v3.7h.5a.6.6 0 0 1 0 1.3H6a.6.6 0 0 1 0-1.3h.4v-3a.6.6 0 0 1-.6-.7Z" clip-rule="evenodd"/></svg>
|
281 |
+
Attention: this Space need to be duplicated to work</h2>
|
282 |
+
<p class="main-message custom-color">
|
283 |
+
To make it work, <strong>duplicate the Space</strong> and run it on your own profile using a <strong>private</strong> GPU (L40s recommended).<br />
|
284 |
+
A L40s costs <strong>US$1.80/h</strong>.
|
285 |
+
</p>
|
286 |
+
<p class="actions custom-color">
|
287 |
+
<a href="https://huggingface.co/spaces/{os.environ['SPACE_ID']}?duplicate=true">
|
288 |
+
<img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-lg-dark.svg" alt="Duplicate this Space" />
|
289 |
+
</a>
|
290 |
+
to start experimenting with this demo
|
291 |
+
</p>
|
292 |
+
</div>
|
293 |
+
''', elem_id="warning-duplicate")
|
294 |
+
else:
|
295 |
+
if(is_gpu_associated):
|
296 |
+
top_description = gr.HTML(f'''
|
297 |
+
<div class="gr-prose">
|
298 |
+
<h2 class="custom-color"><svg xmlns="http://www.w3.org/2000/svg" width="18px" height="18px" style="margin-right: 0px;display: inline-block;"fill="none"><path fill="#fff" d="M7 13.2a6.3 6.3 0 0 0 4.4-10.7A6.3 6.3 0 0 0 .6 6.9 6.3 6.3 0 0 0 7 13.2Z"/><path fill="#fff" fill-rule="evenodd" d="M7 0a6.9 6.9 0 0 1 4.8 11.8A6.9 6.9 0 0 1 0 7 6.9 6.9 0 0 1 7 0Zm0 0v.7V0ZM0 7h.6H0Zm7 6.8v-.6.6ZM13.7 7h-.6.6ZM9.1 1.7c-.7-.3-1.4-.4-2.2-.4a5.6 5.6 0 0 0-4 1.6 5.6 5.6 0 0 0-1.6 4 5.6 5.6 0 0 0 1.6 4 5.6 5.6 0 0 0 4 1.7 5.6 5.6 0 0 0 4-1.7 5.6 5.6 0 0 0 1.7-4 5.6 5.6 0 0 0-1.7-4c-.5-.5-1.1-.9-1.8-1.2Z" clip-rule="evenodd"/><path fill="#000" fill-rule="evenodd" d="M7 2.9a.8.8 0 1 1 0 1.5A.8.8 0 0 1 7 3ZM5.8 5.7c0-.4.3-.6.6-.6h.7c.3 0 .6.2.6.6v3.7h.5a.6.6 0 0 1 0 1.3H6a.6.6 0 0 1 0-1.3h.4v-3a.6.6 0 0 1-.6-.7Z" clip-rule="evenodd"/></svg>
|
299 |
+
You have successfully associated a GPU to this Space π</h2>
|
300 |
+
<p class="custom-color">
|
301 |
+
You will be billed by the minute from when you activated the GPU until when it is turned off.
|
302 |
+
</p>
|
303 |
+
</div>
|
304 |
+
''', elem_id="warning-ready")
|
305 |
+
else:
|
306 |
+
top_description = gr.HTML(f'''
|
307 |
+
<div class="gr-prose">
|
308 |
+
<h2 class="custom-color"><svg xmlns="http://www.w3.org/2000/svg" width="18px" height="18px" style="margin-right: 0px;display: inline-block;"fill="none"><path fill="#fff" d="M7 13.2a6.3 6.3 0 0 0 4.4-10.7A6.3 6.3 0 0 0 .6 6.9 6.3 6.3 0 0 0 7 13.2Z"/><path fill="#fff" fill-rule="evenodd" d="M7 0a6.9 6.9 0 0 1 4.8 11.8A6.9 6.9 0 0 1 0 7 6.9 6.9 0 0 1 7 0Zm0 0v.7V0ZM0 7h.6H0Zm7 6.8v-.6.6ZM13.7 7h-.6.6ZM9.1 1.7c-.7-.3-1.4-.4-2.2-.4a5.6 5.6 0 0 0-4 1.6 5.6 5.6 0 0 0-1.6 4 5.6 5.6 0 0 0 1.6 4 5.6 5.6 0 0 0 4 1.7 5.6 5.6 0 0 0 4-1.7 5.6 5.6 0 0 0 1.7-4 5.6 5.6 0 0 0-1.7-4c-.5-.5-1.1-.9-1.8-1.2Z" clip-rule="evenodd"/><path fill="#000" fill-rule="evenodd" d="M7 2.9a.8.8 0 1 1 0 1.5A.8.8 0 0 1 7 3ZM5.8 5.7c0-.4.3-.6.6-.6h.7c.3 0 .6.2.6.6v3.7h.5a.6.6 0 0 1 0 1.3H6a.6.6 0 0 1 0-1.3h.4v-3a.6.6 0 0 1-.6-.7Z" clip-rule="evenodd"/></svg>
|
309 |
+
You have successfully duplicated the MimicMotion Space π</h2>
|
310 |
+
<p class="custom-color">There's only one step left before you can properly play with this demo: <a href="https://huggingface.co/spaces/{os.environ['SPACE_ID']}/settings" style="text-decoration: underline" target="_blank">attribute a GPU</b> to it (via the Settings tab)</a> and run the app below.
|
311 |
+
You will be billed by the minute from when you activate the GPU until when it is turned off.</p>
|
312 |
+
<p class="actions custom-color">
|
313 |
+
<a href="https://huggingface.co/spaces/{os.environ['SPACE_ID']}/settings">π₯ Set recommended GPU</a>
|
314 |
+
</p>
|
315 |
+
</div>
|
316 |
+
''', elem_id="warning-setgpu")
|
317 |
+
|
318 |
output_video = gr.Video(label="Generated Video")
|
319 |
|
320 |
gr.Examples(
|