Spaces:
Runtime error
Runtime error
Commit
·
640072b
1
Parent(s):
9c8b547
Refactor GPU decorator and update FramePack description in app.py
Browse files
app.py
CHANGED
@@ -65,7 +65,6 @@ stream = AsyncStream()
|
|
65 |
outputs_folder = './outputs/'
|
66 |
os.makedirs(outputs_folder, exist_ok=True)
|
67 |
|
68 |
-
|
69 |
@torch.no_grad()
|
70 |
def worker(input_image, prompt, n_prompt, seed, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache):
|
71 |
total_latent_sections = (total_second_length * 30) / (latent_window_size * 4)
|
@@ -272,7 +271,7 @@ def worker(input_image, prompt, n_prompt, seed, total_second_length, latent_wind
|
|
272 |
stream.output_queue.push(('end', None))
|
273 |
return
|
274 |
|
275 |
-
@spaces.GPU()
|
276 |
def process(input_image, prompt, n_prompt, seed, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache):
|
277 |
global stream
|
278 |
assert input_image is not None, 'No input image!'
|
@@ -315,7 +314,22 @@ quick_prompts = [[x] for x in quick_prompts]
|
|
315 |
css = make_progress_bar_css()
|
316 |
block = gr.Blocks(css=css).queue()
|
317 |
with block:
|
318 |
-
gr.Markdown('
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
319 |
with gr.Row():
|
320 |
with gr.Column():
|
321 |
input_image = gr.Image(sources='upload', type="numpy", label="Image", height=320)
|
@@ -354,4 +368,4 @@ with block:
|
|
354 |
end_button.click(fn=end_process)
|
355 |
|
356 |
|
357 |
-
block.
|
|
|
65 |
outputs_folder = './outputs/'
|
66 |
os.makedirs(outputs_folder, exist_ok=True)
|
67 |
|
|
|
68 |
@torch.no_grad()
|
69 |
def worker(input_image, prompt, n_prompt, seed, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache):
|
70 |
total_latent_sections = (total_second_length * 30) / (latent_window_size * 4)
|
|
|
271 |
stream.output_queue.push(('end', None))
|
272 |
return
|
273 |
|
274 |
+
@spaces.GPU(duration=120)
|
275 |
def process(input_image, prompt, n_prompt, seed, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache):
|
276 |
global stream
|
277 |
assert input_image is not None, 'No input image!'
|
|
|
314 |
css = make_progress_bar_css()
|
315 |
block = gr.Blocks(css=css).queue()
|
316 |
with block:
|
317 |
+
gr.Markdown('''
|
318 |
+
# [FramePack](https://github.com/lllyasviel/FramePack)
|
319 |
+
|
320 |
+
## Image to Video Animation Tool
|
321 |
+
|
322 |
+
FramePack transforms still images into smooth, natural-looking animations using AI. Upload a portrait or character image and describe the motion you want to see.
|
323 |
+
|
324 |
+
### How to use:
|
325 |
+
1. **Upload an image** - Best results with clear, well-lit portraits
|
326 |
+
2. **Enter a prompt** describing the movement (or select from quick examples)
|
327 |
+
3. **Click "Start Generation"** and wait for the video to be created
|
328 |
+
|
329 |
+
Generation takes a few minutes. The video is created in reverse order, so the beginning of the animation will appear last.
|
330 |
+
|
331 |
+
*For high-quality results, use simple and clear descriptions of movements.*
|
332 |
+
''')
|
333 |
with gr.Row():
|
334 |
with gr.Column():
|
335 |
input_image = gr.Image(sources='upload', type="numpy", label="Image", height=320)
|
|
|
368 |
end_button.click(fn=end_process)
|
369 |
|
370 |
|
371 |
+
block.launch(share=True)
|