Spaces:
Running
on
Zero
Running
on
Zero
bugfix
Browse files
app.py
CHANGED
@@ -314,19 +314,20 @@ def generate_tracking_cotracker(video_tensor, density=30):
|
|
314 |
# 将结果返回
|
315 |
return pred_tracks_with_depth.squeeze(0), pred_visibility.squeeze(0)
|
316 |
|
317 |
-
@spaces.GPU(duration=
|
318 |
def apply_tracking_unified(video_tensor, tracking_tensor, repaint_img_tensor, prompt, fps):
|
319 |
"""统一的应用跟踪函数"""
|
320 |
-
print("--- Entering apply_tracking_unified ---")
|
321 |
-
print(f"Prompt received: {prompt}")
|
322 |
-
print(f"FPS received: {fps}")
|
323 |
-
print(f"Video tensor shape: {video_tensor.shape if video_tensor is not None else None}")
|
324 |
-
print(f"Tracking tensor shape: {tracking_tensor.shape if tracking_tensor is not None else None}")
|
325 |
-
print(f"Repaint tensor shape: {repaint_img_tensor.shape if repaint_img_tensor is not None else None}")
|
326 |
try:
|
327 |
if video_tensor is None or tracking_tensor is None:
|
|
|
328 |
return None
|
329 |
-
|
330 |
das = get_das_pipeline()
|
331 |
output_path = das.apply_tracking(
|
332 |
video_tensor=video_tensor,
|
@@ -335,15 +336,27 @@ def apply_tracking_unified(video_tensor, tracking_tensor, repaint_img_tensor, pr
|
|
335 |
img_cond_tensor=repaint_img_tensor,
|
336 |
prompt=prompt,
|
337 |
checkpoint_path=DEFAULT_MODEL_PATH,
|
338 |
-
num_inference_steps=
|
339 |
)
|
340 |
-
|
341 |
-
print(f"
|
342 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
343 |
# 确保返回的是绝对路径
|
344 |
if output_path and not os.path.isabs(output_path):
|
345 |
output_path = os.path.abspath(output_path)
|
346 |
-
|
347 |
# 检查文件是否存在
|
348 |
if output_path and os.path.exists(output_path):
|
349 |
print(f"文件存在,大小: {os.path.getsize(output_path)} 字节")
|
|
|
314 |
# 将结果返回
|
315 |
return pred_tracks_with_depth.squeeze(0), pred_visibility.squeeze(0)
|
316 |
|
317 |
+
@spaces.GPU(duration=350)
|
318 |
def apply_tracking_unified(video_tensor, tracking_tensor, repaint_img_tensor, prompt, fps):
|
319 |
"""统一的应用跟踪函数"""
|
320 |
+
print("--- Entering apply_tracking_unified ---")
|
321 |
+
print(f"Prompt received: {prompt}")
|
322 |
+
print(f"FPS received: {fps}")
|
323 |
+
print(f"Video tensor shape: {video_tensor.shape if video_tensor is not None else None}")
|
324 |
+
print(f"Tracking tensor shape: {tracking_tensor.shape if tracking_tensor is not None else None}")
|
325 |
+
print(f"Repaint tensor shape: {repaint_img_tensor.shape if repaint_img_tensor is not None else None}")
|
326 |
try:
|
327 |
if video_tensor is None or tracking_tensor is None:
|
328 |
+
print("Error: Video tensor or tracking tensor is None.")
|
329 |
return None
|
330 |
+
|
331 |
das = get_das_pipeline()
|
332 |
output_path = das.apply_tracking(
|
333 |
video_tensor=video_tensor,
|
|
|
336 |
img_cond_tensor=repaint_img_tensor,
|
337 |
prompt=prompt,
|
338 |
checkpoint_path=DEFAULT_MODEL_PATH,
|
339 |
+
num_inference_steps=25
|
340 |
)
|
341 |
+
|
342 |
+
print(f"das.apply_tracking returned: {output_path}")
|
343 |
+
|
344 |
+
# --- 临时解决方案开始 ---
|
345 |
+
# 检查 das.apply_tracking 是否返回 None,并尝试使用日志中看到的固定路径
|
346 |
+
potential_fixed_path = os.path.join(project_root, OUTPUT_DIR, "result.mp4") # 构建预期的固定路径
|
347 |
+
print(f"Checking potential fixed path: {potential_fixed_path}")
|
348 |
+
|
349 |
+
if output_path is None and os.path.exists(potential_fixed_path):
|
350 |
+
print(f"Warning: das.apply_tracking returned None, but found file at {potential_fixed_path}. Using this path.")
|
351 |
+
output_path = potential_fixed_path
|
352 |
+
# --- 临时解决方案结束 ---
|
353 |
+
|
354 |
+
print(f"最终使用的视频路径: {output_path}")
|
355 |
+
|
356 |
# 确保返回的是绝对路径
|
357 |
if output_path and not os.path.isabs(output_path):
|
358 |
output_path = os.path.abspath(output_path)
|
359 |
+
|
360 |
# 检查文件是否存在
|
361 |
if output_path and os.path.exists(output_path):
|
362 |
print(f"文件存在,大小: {os.path.getsize(output_path)} 字节")
|