Spaces:
Running
Running
Deepro Bardhan
commited on
Commit
·
2c5b827
1
Parent(s):
2405f92
time remaining bug fix1
Browse files
app.py
CHANGED
|
@@ -49,7 +49,7 @@ def swap_single_photo(src_img, src_idx, dst_img, dst_idx, progress=gr.Progress(t
|
|
| 49 |
progress(1, desc="Error")
|
| 50 |
return None, log
|
| 51 |
|
| 52 |
-
def swap_video(src_img, src_idx, video, dst_idx, progress=gr.Progress(
|
| 53 |
log = ""
|
| 54 |
src_path = "VideoSwapping/data_src.jpg"
|
| 55 |
dst_video_path = "VideoSwapping/data_dst.mp4"
|
|
@@ -94,7 +94,7 @@ def swap_video(src_img, src_idx, video, dst_idx, progress=gr.Progress(track_tqdm
|
|
| 94 |
avg_time = elapsed / (idx + 1) if idx + 1 > 0 else 0
|
| 95 |
remaining = avg_time * (total_frames - (idx + 1))
|
| 96 |
mins, secs = divmod(int(remaining), 60)
|
| 97 |
-
progress(0.15 + 0.6 * (idx + 1) / total_frames, desc=f"Swapping
|
| 98 |
continue
|
| 99 |
try:
|
| 100 |
try:
|
|
@@ -114,7 +114,7 @@ def swap_video(src_img, src_idx, video, dst_idx, progress=gr.Progress(track_tqdm
|
|
| 114 |
avg_time = elapsed / (idx + 1) if idx + 1 > 0 else 0
|
| 115 |
remaining = avg_time * (total_frames - (idx + 1))
|
| 116 |
mins, secs = divmod(int(remaining), 60)
|
| 117 |
-
progress(0.15 + 0.6 * (idx + 1) / total_frames, desc=f"Swapping
|
| 118 |
cap = cv2.VideoCapture(dst_video_path)
|
| 119 |
fps = cap.get(cv2.CAP_PROP_FPS)
|
| 120 |
cap.release()
|
|
|
|
| 49 |
progress(1, desc="Error")
|
| 50 |
return None, log
|
| 51 |
|
| 52 |
+
def swap_video(src_img, src_idx, video, dst_idx, progress=gr.Progress()):
|
| 53 |
log = ""
|
| 54 |
src_path = "VideoSwapping/data_src.jpg"
|
| 55 |
dst_video_path = "VideoSwapping/data_dst.mp4"
|
|
|
|
| 94 |
avg_time = elapsed / (idx + 1) if idx + 1 > 0 else 0
|
| 95 |
remaining = avg_time * (total_frames - (idx + 1))
|
| 96 |
mins, secs = divmod(int(remaining), 60)
|
| 97 |
+
progress(0.15 + 0.6 * (idx + 1) / total_frames, desc=f"Swapping {idx+1}/{total_frames} | {mins:02d}:{secs:02d} left")
|
| 98 |
continue
|
| 99 |
try:
|
| 100 |
try:
|
|
|
|
| 114 |
avg_time = elapsed / (idx + 1) if idx + 1 > 0 else 0
|
| 115 |
remaining = avg_time * (total_frames - (idx + 1))
|
| 116 |
mins, secs = divmod(int(remaining), 60)
|
| 117 |
+
progress(0.15 + 0.6 * (idx + 1) / total_frames, desc=f"Swapping {idx+1}/{total_frames} | {mins:02d}:{secs:02d} left")
|
| 118 |
cap = cv2.VideoCapture(dst_video_path)
|
| 119 |
fps = cap.get(cv2.CAP_PROP_FPS)
|
| 120 |
cap.release()
|