Spaces:
Runtime error
Runtime error
Commit ·
640072b
1
Parent(s): 9c8b547
Refactor GPU decorator and update FramePack description in app.py
Browse files64 unmodified lines65666768697071200 unmodified lines27227327427527627727836 unmodified lines31531631731831932032132 unmodified lines35435535635764 unmodified linesoutputs_folder = './outputs/'os.makedirs(outputs_folder, exist_ok=True)@torch.no_grad()def worker(input_image, prompt, n_prompt, seed, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache):total_latent_sections = (total_second_length * 30) / (latent_window_size * 4)200 unmodified linesstream.output_queue.push(('end', None))return@spaces.GPU()def process(input_image, prompt, n_prompt, seed, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache):global streamassert input_image is not None, 'No input image!'36 unmodified linescss = make_progress_bar_css()block = gr.Blocks(css=css).queue()with block:gr.Markdown('# FramePack')with gr.Row():with gr.Column():input_image = gr.Image(sources='upload', type="numpy", label="Image", height=320)32 unmodified linesend_button.click(fn=end_process)block.queue().launch(share=True)64 unmodified lines656667686970200 unmodified lines27127227327427527627736 unmodified lines31431531631731831932032132232332432532632732832933033133233333433532 unmodified lines36836937037164 unmodified linesoutputs_folder = './outputs/'os.makedirs(outputs_folder, exist_ok=True)@torch.no_grad()def worker(input_image, prompt, n_prompt, seed, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache):total_latent_sections = (total_second_length * 30) / (latent_window_size * 4)200 unmodified linesstream.output_queue.push(('end', None))return@spaces.GPU(duration=120)def process(input_image, prompt, n_prompt, seed, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache):global streamassert input_image is not None, 'No input image!'36 unmodified linescss = make_progress_bar_css()block = gr.Blocks(css=css).queue()with block:gr.Markdown('''# [FramePack](https://github.com/lllyasviel/FramePack)## Image to Video Animation ToolFramePack transforms still images into smooth, natural-looking animations using AI. Upload a portrait or character image and describe the motion you want to see.### How to use:1. **Upload an image** - Best results with clear, well-lit portraits2. **Enter a prompt** describing the movement (or select from quick examples)3. **Click "Start Generation"** and wait for the video to be createdGeneration takes a few minutes. The video is created in reverse order, so the beginning of the animation will appear last.*For high-quality results, use simple and clear descriptions of movements.*''')with gr.Row():with gr.Column():input_image = gr.Image(sources='upload', type="numpy", label="Image", height=320)32 unmodified linesend_button.click(fn=end_process)block.launch(share=True)
app.py+18-4