Yw22 commited on
Commit
b4f5528
1 Parent(s): 27c0c26
Files changed (1) hide show
  1. app.py +13 -5
app.py CHANGED
@@ -288,7 +288,7 @@ class ImageConductor:
288
 
289
  self.blur_kernel = blur_kernel
290
 
291
- @spaces.GPU(duration=100)
292
  def run(self, first_frame_path, tracking_points, prompt, drag_mode, negative_prompt, seed, randomize_seed, guidance_scale, num_inference_steps, personalized, examples_type):
293
  print("Run!")
294
  if examples_type != "":
@@ -411,14 +411,22 @@ def add_tracking_points(tracking_points, first_frame_path, drag_mode, evt: gr.Se
411
  elif drag_mode=='camera':
412
  color = (0, 0, 255, 255)
413
 
414
- print(f"You selected {evt.value} at {evt.index} from {evt.target}")
415
- tracking_points.value[-1].append(evt.index)
416
- print(tracking_points.value)
 
 
 
 
 
 
 
417
 
418
  transparent_background = Image.open(first_frame_path).convert('RGBA')
419
  w, h = transparent_background.size
420
  transparent_layer = np.zeros((h, w, 4))
421
- for track in tracking_points.value:
 
422
  if len(track) > 1:
423
  for i in range(len(track)-1):
424
  start_point = track[i]
 
288
 
289
  self.blur_kernel = blur_kernel
290
 
291
+ @spaces.GPU(duration=150)
292
  def run(self, first_frame_path, tracking_points, prompt, drag_mode, negative_prompt, seed, randomize_seed, guidance_scale, num_inference_steps, personalized, examples_type):
293
  print("Run!")
294
  if examples_type != "":
 
411
  elif drag_mode=='camera':
412
  color = (0, 0, 255, 255)
413
 
414
+ if not isinstance(tracking_points ,list):
415
+ print(f"You selected {evt.value} at {evt.index} from {evt.target}")
416
+ tracking_points.value[-1].append(evt.index)
417
+ print(tracking_points.value)
418
+ tracking_points_values = tracking_points.value
419
+ else:
420
+ tracking_points[-1].append(evt.index)
421
+ tracking_points_values = tracking_points
422
+
423
+
424
 
425
  transparent_background = Image.open(first_frame_path).convert('RGBA')
426
  w, h = transparent_background.size
427
  transparent_layer = np.zeros((h, w, 4))
428
+
429
+ for track in tracking_points_values:
430
  if len(track) > 1:
431
  for i in range(len(track)-1):
432
  start_point = track[i]