linoyts HF Staff commited on
Commit
20982df
·
verified ·
1 Parent(s): 92cfd25

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -3
app.py CHANGED
@@ -288,9 +288,14 @@ def get_duration(input_image, prompt, n_prompt, seed, total_second_length, laten
288
  return total_second_length * 60
289
 
290
  @spaces.GPU(duration=get_duration)
291
- def process(input_image, prompt, n_prompt, seed, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache, mp4_crf):
292
  global stream
293
- assert input_image is not None, 'No input image!'
 
 
 
 
 
294
 
295
  yield None, None, '', '', gr.update(interactive=False), gr.update(interactive=True)
296
 
@@ -331,10 +336,13 @@ css = make_progress_bar_css()
331
  block = gr.Blocks(css=css).queue()
332
  with block:
333
  gr.Markdown('# FramePack-F1')
 
 
334
  with gr.Row():
335
  with gr.Column():
336
  input_image = gr.Image(sources='upload', type="numpy", label="Image", height=320)
337
  prompt = gr.Textbox(label="Prompt", value='')
 
338
  example_quick_prompts = gr.Dataset(samples=quick_prompts, label='Quick List', samples_per_page=1000, components=[prompt])
339
  example_quick_prompts.click(lambda x: x[0], inputs=[example_quick_prompts], outputs=prompt, show_progress=False, queue=False)
340
 
@@ -370,7 +378,7 @@ with block:
370
 
371
  gr.HTML('<div style="text-align:center; margin-top:20px;">Share your results and find ideas at the <a href="https://x.com/search?q=framepack&f=live" target="_blank">FramePack Twitter (X) thread</a></div>')
372
 
373
- ips = [input_image, prompt, n_prompt, seed, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache, mp4_crf]
374
  start_button.click(fn=process, inputs=ips, outputs=[result_video, preview_image, progress_desc, progress_bar, start_button, end_button])
375
  end_button.click(fn=end_process)
376
 
 
288
  return total_second_length * 60
289
 
290
  @spaces.GPU(duration=get_duration)
291
+ def process(input_image, prompt, t2v, n_prompt, seed, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache, mp4_crf):
292
  global stream
293
+
294
+ # assert input_image is not None, 'No input image!'
295
+ if t2v:
296
+ default_height, default_width = 640, 640
297
+ input_image = np.ones((default_height, default_width, 3), dtype=np.uint8) * 255
298
+ print("No input image provided. Using a blank white image.")
299
 
300
  yield None, None, '', '', gr.update(interactive=False), gr.update(interactive=True)
301
 
 
336
  block = gr.Blocks(css=css).queue()
337
  with block:
338
  gr.Markdown('# FramePack-F1')
339
+ gr.Markdown('Demo for FramePack F1 - a FramePack model that only predicts future frames from history frames')
340
+ gr.Markdown('adapted from the officical code repo [FramePack](https://github.com/lllyasviel/FramePack) by lllyasviel and (FramePack Studio)[https://github.com/colinurbs/FramePack-Studio]')
341
  with gr.Row():
342
  with gr.Column():
343
  input_image = gr.Image(sources='upload', type="numpy", label="Image", height=320)
344
  prompt = gr.Textbox(label="Prompt", value='')
345
+ t2v = gr.Checkbox(label="do text-to-video", value=False)
346
  example_quick_prompts = gr.Dataset(samples=quick_prompts, label='Quick List', samples_per_page=1000, components=[prompt])
347
  example_quick_prompts.click(lambda x: x[0], inputs=[example_quick_prompts], outputs=prompt, show_progress=False, queue=False)
348
 
 
378
 
379
  gr.HTML('<div style="text-align:center; margin-top:20px;">Share your results and find ideas at the <a href="https://x.com/search?q=framepack&f=live" target="_blank">FramePack Twitter (X) thread</a></div>')
380
 
381
+ ips = [input_image, prompt, t2v, n_prompt, seed, total_second_length, latent_window_size, steps, cfg, gs, rs, gpu_memory_preservation, use_teacache, mp4_crf]
382
  start_button.click(fn=process, inputs=ips, outputs=[result_video, preview_image, progress_desc, progress_bar, start_button, end_button])
383
  end_button.click(fn=end_process)
384