xizaoqu commited on
Commit
328e899
·
1 Parent(s): 2076f2e
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -173,17 +173,13 @@ def run(cfg: DictConfig):
173
  memory_frames.append(load_image_as_tensor(DEFAULT_IMAGE))
174
 
175
  @spaces.GPU()
176
- def run_interactive(first_frame, action, first_pose, curr_frame, device):
177
- global algo
178
  new_frame = algo.interactive(first_frame,
179
  action,
180
  first_pose,
181
  curr_frame,
182
  device=device)
183
- print("run????")
184
- print(algo.frames)
185
- print(new_frame)
186
- return new_frame
187
 
188
  def set_denoising_steps(denoising_steps, sampling_timesteps_state):
189
  algo.sampling_timesteps = denoising_steps
@@ -201,7 +197,7 @@ def run(cfg: DictConfig):
201
 
202
  for i in range(len(actions)):
203
  memory_curr_frame += 1
204
- new_frame = run_interactive(memory_frames[0],
205
  actions[i],
206
  None,
207
  memory_curr_frame,
@@ -233,7 +229,7 @@ def run(cfg: DictConfig):
233
  memory_curr_frame = 0
234
  input_history = ""
235
 
236
- _ = run_interactive(memory_frames[0],
237
  actions[0],
238
  poses[0],
239
  memory_curr_frame,
@@ -246,7 +242,7 @@ def run(cfg: DictConfig):
246
  reset()
247
  return SELECTED_IMAGE
248
 
249
- _ = run_interactive(memory_frames[0],
250
  actions[0],
251
  poses[0],
252
  memory_curr_frame,
 
173
  memory_frames.append(load_image_as_tensor(DEFAULT_IMAGE))
174
 
175
  @spaces.GPU()
176
+ def run_interactive(algo, first_frame, action, first_pose, curr_frame, device):
 
177
  new_frame = algo.interactive(first_frame,
178
  action,
179
  first_pose,
180
  curr_frame,
181
  device=device)
182
+ return algo, new_frame
 
 
 
183
 
184
  def set_denoising_steps(denoising_steps, sampling_timesteps_state):
185
  algo.sampling_timesteps = denoising_steps
 
197
 
198
  for i in range(len(actions)):
199
  memory_curr_frame += 1
200
+ algo, new_frame = run_interactive(algo, memory_frames[0],
201
  actions[i],
202
  None,
203
  memory_curr_frame,
 
229
  memory_curr_frame = 0
230
  input_history = ""
231
 
232
+ algo, _ = run_interactive(algo, memory_frames[0],
233
  actions[0],
234
  poses[0],
235
  memory_curr_frame,
 
242
  reset()
243
  return SELECTED_IMAGE
244
 
245
+ algo, _ = run_interactive(algo, memory_frames[0],
246
  actions[0],
247
  poses[0],
248
  memory_curr_frame,