Update app.py
Browse files
app.py
CHANGED
|
@@ -14,6 +14,7 @@ import sys
|
|
| 14 |
import gc
|
| 15 |
import numpy as np
|
| 16 |
from gradio_modal import Modal
|
|
|
|
| 17 |
|
| 18 |
def draw_points(img, points, labels):
|
| 19 |
out = img.copy()
|
|
@@ -521,48 +522,12 @@ def animate_scene(input_video, max_duration_s, edited_frame, rc_str,
|
|
| 521 |
|
| 522 |
print(f'{session_id} inference started with {rc_str} and duration of {max_duration_s}')
|
| 523 |
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
|
| 527 |
-
|
| 528 |
-
pts_by_frame, lbs_by_frame, session_id, progress
|
| 529 |
-
)
|
| 530 |
-
except Exception as e:
|
| 531 |
-
err = str(e).lower()
|
| 532 |
-
print(f"{session_id} failed due to {err}")
|
| 533 |
-
|
| 534 |
-
if "zerogpu quotas" not in err and "pro gpu quota" not in err:
|
| 535 |
-
raise
|
| 536 |
-
|
| 537 |
-
if max_duration_s > 2:
|
| 538 |
-
raise
|
| 539 |
-
|
| 540 |
-
max_duration_s = -1
|
| 541 |
-
|
| 542 |
-
try:
|
| 543 |
-
pts_by_frame, lbs_by_frame = {}, {}
|
| 544 |
-
|
| 545 |
-
output_video_path = _animate(
|
| 546 |
-
input_video, max_duration_s, edited_frame_png, rc_bool,
|
| 547 |
-
pts_by_frame, lbs_by_frame, session_id, progress
|
| 548 |
-
)
|
| 549 |
-
except Exception as e:
|
| 550 |
-
err = str(e).lower()
|
| 551 |
-
print(f"{session_id} failed due to {err}")
|
| 552 |
-
|
| 553 |
-
if "unlogged" in err:
|
| 554 |
-
max_duration_s = -2
|
| 555 |
-
|
| 556 |
-
gr.Info("Sign up for free or login to get at least 2 generations for free")
|
| 557 |
-
|
| 558 |
-
output_video_path = _animate(
|
| 559 |
-
input_video, max_duration_s, edited_frame_png, rc_bool,
|
| 560 |
-
pts_by_frame, lbs_by_frame, session_id, progress
|
| 561 |
-
)
|
| 562 |
-
else:
|
| 563 |
-
raise
|
| 564 |
|
| 565 |
-
final_video_path =
|
| 566 |
|
| 567 |
preprocess_dir = os.path.join(output_dir, "preprocess_dir")
|
| 568 |
pose_video = os.path.join(preprocess_dir, 'src_pose.mp4')
|
|
|
|
| 14 |
import gc
|
| 15 |
import numpy as np
|
| 16 |
from gradio_modal import Modal
|
| 17 |
+
import tempfile
|
| 18 |
|
| 19 |
def draw_points(img, points, labels):
|
| 20 |
out = img.copy()
|
|
|
|
| 522 |
|
| 523 |
print(f'{session_id} inference started with {rc_str} and duration of {max_duration_s}')
|
| 524 |
|
| 525 |
+
output_video_path = _animate(
|
| 526 |
+
input_video, max_duration_s, edited_frame_png, rc_bool,
|
| 527 |
+
pts_by_frame, lbs_by_frame, session_id, progress
|
| 528 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 529 |
|
| 530 |
+
final_video_path = tempfile.NamedTemporaryFile(suffix=".mp4", delete=False).name
|
| 531 |
|
| 532 |
preprocess_dir = os.path.join(output_dir, "preprocess_dir")
|
| 533 |
pose_video = os.path.join(preprocess_dir, 'src_pose.mp4')
|