MogensR commited on
Commit
b592ffc
·
verified ·
1 Parent(s): 3e5c70d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -4
app.py CHANGED
@@ -1449,17 +1449,34 @@ def process_video_main(
1449
  final_path = result[0] # Extract just the path
1450
  status_message = result[-1] # Extract the status message
1451
 
 
 
 
1452
  if final_path and os.path.exists(final_path):
 
1453
  status_messages.append("TwoStageProcessor completed successfully with SAM2 Large (WORKING VERSION)")
1454
  status_messages.append(status_message)
1455
 
1456
- # Copy to desired output location
1457
  output_path = OUT_DIR / f"final_output_{int(time.time())}_{uuid4().hex[:6]}.mp4"
1458
- shutil.copy2(final_path, str(output_path))
1459
- return str(output_path), "\n".join(status_messages)
 
 
 
 
 
 
 
 
 
 
 
1460
  else:
1461
- return None, f"TwoStageProcessor failed: {status_message}"
 
1462
  else:
 
1463
  return None, f"TwoStageProcessor returned unexpected format: {result}"
1464
 
1465
  except ImportError as e:
 
1449
  final_path = result[0] # Extract just the path
1450
  status_message = result[-1] # Extract the status message
1451
 
1452
+ logger.info(f"DEBUG: TwoStageProcessor returned final_path: {final_path}")
1453
+ logger.info(f"DEBUG: TwoStageProcessor returned status: {status_message}")
1454
+
1455
  if final_path and os.path.exists(final_path):
1456
+ logger.info(f"DEBUG: Final path exists, size: {os.path.getsize(final_path)} bytes")
1457
  status_messages.append("TwoStageProcessor completed successfully with SAM2 Large (WORKING VERSION)")
1458
  status_messages.append(status_message)
1459
 
1460
+ # Copy to desired output location with better error handling
1461
  output_path = OUT_DIR / f"final_output_{int(time.time())}_{uuid4().hex[:6]}.mp4"
1462
+ try:
1463
+ logger.info(f"DEBUG: Copying {final_path} to {output_path}")
1464
+ shutil.copy2(final_path, str(output_path))
1465
+
1466
+ if os.path.exists(output_path):
1467
+ logger.info(f"DEBUG: Copy successful, output size: {os.path.getsize(output_path)} bytes")
1468
+ return str(output_path), "\n".join(status_messages)
1469
+ else:
1470
+ logger.error("DEBUG: Copy failed - output file does not exist")
1471
+ return None, f"Copy failed: output file not created"
1472
+ except Exception as copy_error:
1473
+ logger.error(f"DEBUG: Copy failed with error: {copy_error}")
1474
+ return None, f"Copy failed: {str(copy_error)}"
1475
  else:
1476
+ logger.error(f"DEBUG: Final path does not exist or is None: {final_path}")
1477
+ return None, f"TwoStageProcessor failed: {status_message} (final_path: {final_path})"
1478
  else:
1479
+ logger.error(f"DEBUG: TwoStageProcessor returned unexpected format: {result}")
1480
  return None, f"TwoStageProcessor returned unexpected format: {result}"
1481
 
1482
  except ImportError as e: