Anonymous commited on
Commit
45e7ac3
1 Parent(s): 254e689

add spaces

Browse files
Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -47,6 +47,15 @@ def check_move(trajectory, video_length=16):
47
 
48
  return True
49
 
 
 
 
 
 
 
 
 
 
50
  @spaces.GPU(duration=280)
51
  def infer(*user_args):
52
  prompt_in = user_args[0]
@@ -698,6 +707,7 @@ with gr.Blocks(css=css) as demo:
698
 
699
  with gr.Row():
700
  submit_btn = gr.Button("Generate", variant='primary')
 
701
 
702
  with gr.Row():
703
  gr.Examples(label='Sample Prompts', examples=examples, inputs=[prompt_in, target_indices, ddim_edit, seed, ddim_steps, unconditional_guidance_scale, video_fps, save_fps, height_ratio, width_ratio, radio_mode, dropdown_diy, *frame_indices, *h_positions, *w_positions])
@@ -731,6 +741,11 @@ with gr.Blocks(css=css) as demo:
731
  submit_btn.click(fn=infer,
732
  inputs=[prompt_in, target_indices, ddim_edit, seed, ddim_steps, unconditional_guidance_scale, video_fps, save_fps, height_ratio, width_ratio, radio_mode, dropdown_diy, *frame_indices, *h_positions, *w_positions],
733
  outputs=[video_result, video_result_bbox],
734
- api_name="freetraj")
 
 
 
 
 
735
 
736
  demo.queue(max_size=8).launch(show_api=True)
 
47
 
48
  return True
49
 
50
+ def check(radio_mode):
51
+ if radio_mode == 'ori':
52
+ video_path = "output.mp4"
53
+ video_bbox_path = "output.mp4"
54
+ else:
55
+ video_path = "output_freetraj.mp4"
56
+ video_bbox_path = "output_freetraj_bbox.mp4"
57
+ return video_path, video_bbox_path
58
+
59
  @spaces.GPU(duration=280)
60
  def infer(*user_args):
61
  prompt_in = user_args[0]
 
707
 
708
  with gr.Row():
709
  submit_btn = gr.Button("Generate", variant='primary')
710
+ check_btn = gr.Button("Check Existing Results", variant='primary')
711
 
712
  with gr.Row():
713
  gr.Examples(label='Sample Prompts', examples=examples, inputs=[prompt_in, target_indices, ddim_edit, seed, ddim_steps, unconditional_guidance_scale, video_fps, save_fps, height_ratio, width_ratio, radio_mode, dropdown_diy, *frame_indices, *h_positions, *w_positions])
 
741
  submit_btn.click(fn=infer,
742
  inputs=[prompt_in, target_indices, ddim_edit, seed, ddim_steps, unconditional_guidance_scale, video_fps, save_fps, height_ratio, width_ratio, radio_mode, dropdown_diy, *frame_indices, *h_positions, *w_positions],
743
  outputs=[video_result, video_result_bbox],
744
+ api_name="generate")
745
+
746
+ check_btn.click(fn=check,
747
+ inputs=[radio_mode],
748
+ outputs=[video_result, video_result_bbox],
749
+ api_name="check")
750
 
751
  demo.queue(max_size=8).launch(show_api=True)