Spaces:
Starting
Starting
Update app.py
Browse files
app.py
CHANGED
@@ -536,22 +536,21 @@ with gr.Blocks(css=css) as demo:
|
|
536 |
|
537 |
global locations
|
538 |
if not coordinates:
|
539 |
-
|
540 |
else:
|
541 |
-
|
542 |
-
print(
|
543 |
|
544 |
avg_coords = [0.0, 0.0]
|
545 |
-
for location in
|
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(
|
550 |
-
avg_coords[1] = avg_coords[1] / len(
|
551 |
-
|
552 |
-
for location in
|
553 |
-
|
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
|