freealise commited on
Commit
078b694
1 Parent(s): a882393

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -536,22 +536,21 @@ with gr.Blocks(css=css) as demo:
536
 
537
  global locations
538
  if not coordinates:
539
- locations = example_coords.split()
540
  else:
541
- locations = coordinates.split()
542
- print(locations)
543
 
544
  avg_coords = [0.0, 0.0]
545
- for location in locations:
546
  location = location.split(',')
547
  avg_coords[0] = avg_coords[0] + float(location[0])
548
  avg_coords[1] = avg_coords[1] + float(location[1])
549
- avg_coords[0] = avg_coords[0] / len(locations)
550
- avg_coords[1] = avg_coords[1] / len(locations)
551
-
552
- for location in locations:
553
- location[0] = float(location[0]) - avg_coords[0]
554
- location[1] = float(location[1]) - avg_coords[1]
555
  print(locations)
556
 
557
  # Process the video and get the path of the output video
 
536
 
537
  global locations
538
  if not coordinates:
539
+ locations_str = example_coords.split()
540
  else:
541
+ locations_str = coordinates.split()
542
+ print(locations_str)
543
 
544
  avg_coords = [0.0, 0.0]
545
+ for location in locations_str:
546
  location = location.split(',')
547
  avg_coords[0] = avg_coords[0] + float(location[0])
548
  avg_coords[1] = avg_coords[1] + float(location[1])
549
+ avg_coords[0] = avg_coords[0] / len(locations_str)
550
+ avg_coords[1] = avg_coords[1] / len(locations_str)
551
+
552
+ for k, location in enumerate(locations_str):
553
+ locations[k] = [ float(location[0]) - avg_coords[0], float(location[1]) - avg_coords[1] ]
 
554
  print(locations)
555
 
556
  # Process the video and get the path of the output video