fffiloni commited on
Commit
14563b1
1 Parent(s): 7ea551a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -12,6 +12,7 @@ def stream_output(pipe, progress_bar):
12
  for line in iter(pipe.readline, ''):
13
  print(line, end='')
14
  progress_bar.update(1)
 
15
 
16
  HF_TKN = os.environ.get("GATED_HF_TOKEN")
17
  huggingface_hub.login(token=HF_TKN)
@@ -97,7 +98,7 @@ def infer(ref_video_in, ref_image_in, progress=gr.Progress(track_tqdm=True)):
97
  noise_aug_strength = 0
98
  guidance_scale = 2.0
99
  sample_stride = 2
100
- fps = 12
101
  seed = 42
102
 
103
  # Create the data structure
@@ -135,7 +136,7 @@ def infer(ref_video_in, ref_image_in, progress=gr.Progress(track_tqdm=True)):
135
  process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, bufsize=1)
136
 
137
  # Create a tqdm progress bar
138
- progress_bar = tqdm(total=100, desc="Inference Progress", unit="line", ncols=100)
139
 
140
  # Create threads to handle stdout and stderr
141
  stdout_thread = threading.Thread(target=stream_output, args=(process.stdout, progress_bar))
@@ -147,9 +148,9 @@ def infer(ref_video_in, ref_image_in, progress=gr.Progress(track_tqdm=True)):
147
  stderr_thread.start()
148
 
149
  # Wait for the process to complete and the threads to finish
150
- process.wait()
151
  stdout_thread.join()
152
  stderr_thread.join()
 
153
 
154
  # Close the progress bar
155
  progress_bar.close()
 
12
  for line in iter(pipe.readline, ''):
13
  print(line, end='')
14
  progress_bar.update(1)
15
+ pipe.close()
16
 
17
  HF_TKN = os.environ.get("GATED_HF_TOKEN")
18
  huggingface_hub.login(token=HF_TKN)
 
98
  noise_aug_strength = 0
99
  guidance_scale = 2.0
100
  sample_stride = 2
101
+ fps = 15
102
  seed = 42
103
 
104
  # Create the data structure
 
136
  process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, bufsize=1)
137
 
138
  # Create a tqdm progress bar
139
+ progress_bar = tqdm(total=100, desc="Inference Progress", unit="line", ncols=100, leave=True)
140
 
141
  # Create threads to handle stdout and stderr
142
  stdout_thread = threading.Thread(target=stream_output, args=(process.stdout, progress_bar))
 
148
  stderr_thread.start()
149
 
150
  # Wait for the process to complete and the threads to finish
 
151
  stdout_thread.join()
152
  stderr_thread.join()
153
+ process.wait()
154
 
155
  # Close the progress bar
156
  progress_bar.close()