fffiloni commited on
Commit
b21431b
·
verified ·
1 Parent(s): 91d18e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -7
app.py CHANGED
@@ -17,7 +17,7 @@ snapshot_download(
17
  local_dir = folder_name
18
  )
19
 
20
- def process_video(video_path, prompt, num_steps):
21
 
22
  output_folder="noise_warp_output_folder"
23
  if os.path.exists(output_folder):
@@ -25,7 +25,6 @@ def process_video(video_path, prompt, num_steps):
25
  shutil.rmtree(output_folder)
26
  output_video="output.mp4"
27
  device="cuda"
28
- num_steps=num_steps
29
 
30
  try:
31
  # Step 1: Warp the noise
@@ -41,6 +40,7 @@ def process_video(video_path, prompt, num_steps):
41
  inference_command = [
42
  "python", "cut_and_drag_inference.py", output_folder,
43
  "--prompt", prompt,
 
44
  "--output_mp4_path", output_video,
45
  "--device", device,
46
  "--num_inference_steps", str(num_steps)
@@ -70,23 +70,34 @@ with gr.Blocks() as demo:
70
  <a href="https://huggingface.co/spaces/fffiloni/Go-With-The-Flow?duplicate=true">
71
  <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-sm.svg" alt="Duplicate this Space">
72
  </a>
73
- <a href="https://huggingface.co/fffiloni">
74
- <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/follow-me-on-HF-sm-dark.svg" alt="Follow me on HF">
75
- </a>
76
  </div>
77
  """)
78
  with gr.Row():
79
  with gr.Column():
80
  input_video = gr.Video(label="Input Video")
81
  prompt = gr.Textbox(label="Prompt")
82
- num_steps = gr.Slider(label="Inference Steps", minimum=1, maximum=30, value=5, step=1)
 
 
83
  submit_btn = gr.Button("Submit")
 
 
 
 
 
 
 
84
  with gr.Column():
85
  output_video = gr.Video(label="Result")
 
 
 
 
 
86
 
87
  submit_btn.click(
88
  fn = process_video,
89
- inputs = [input_video, prompt, num_steps],
90
  outputs = [output_video]
91
  )
92
 
 
17
  local_dir = folder_name
18
  )
19
 
20
+ def process_video(video_path, prompt, num_steps, degradation_level):
21
 
22
  output_folder="noise_warp_output_folder"
23
  if os.path.exists(output_folder):
 
25
  shutil.rmtree(output_folder)
26
  output_video="output.mp4"
27
  device="cuda"
 
28
 
29
  try:
30
  # Step 1: Warp the noise
 
40
  inference_command = [
41
  "python", "cut_and_drag_inference.py", output_folder,
42
  "--prompt", prompt,
43
+ "--degradation", degradation_level,
44
  "--output_mp4_path", output_video,
45
  "--device", device,
46
  "--num_inference_steps", str(num_steps)
 
70
  <a href="https://huggingface.co/spaces/fffiloni/Go-With-The-Flow?duplicate=true">
71
  <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-sm.svg" alt="Duplicate this Space">
72
  </a>
 
 
 
73
  </div>
74
  """)
75
  with gr.Row():
76
  with gr.Column():
77
  input_video = gr.Video(label="Input Video")
78
  prompt = gr.Textbox(label="Prompt")
79
+ with gr.Row():
80
+ num_steps = gr.Slider(label="Inference Steps", minimum=1, maximum=30, value=5, step=1)
81
+ degradation = gr.Slider(label="Noise Degradation", minimum=0, maximum=1, value=0, step=0.1)
82
  submit_btn = gr.Button("Submit")
83
+ gr.Examples(
84
+ examples = [
85
+ ["./examples/example_1.mp4", "yellow plastic dick is swimming and jumping in the water"],
86
+ ["./examples/example_2.mp4", "the car starts and go forward to the end of the street"]
87
+ ],
88
+ inputs = [input_video, prompt]
89
+ )
90
  with gr.Column():
91
  output_video = gr.Video(label="Result")
92
+ gr.HTML("""
93
+ <a href="https://huggingface.co/fffiloni">
94
+ <img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/follow-me-on-HF-sm-dark.svg" alt="Follow me on HF"> for space updates
95
+ </a>
96
+ """)
97
 
98
  submit_btn.click(
99
  fn = process_video,
100
+ inputs = [input_video, prompt, num_steps, degradation],
101
  outputs = [output_video]
102
  )
103