Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,11 @@ except Exception as e:
|
|
| 7 |
print("Failed to import analyze_video:", e)
|
| 8 |
def analyze_video(*args, **kwargs):
|
| 9 |
print("Stub analyze_video called.")
|
| 10 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# Force rebuild to use Flask
|
| 13 |
|
|
@@ -63,13 +67,21 @@ def upload():
|
|
| 63 |
print(f"π Saved video to: {filepath}")
|
| 64 |
|
| 65 |
try:
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
| 67 |
print(f"β
analyze_video returned: {result_image}")
|
| 68 |
except Exception as e:
|
| 69 |
print(f"β analyze_video failed: {e}")
|
| 70 |
result_image = "placeholder.jpg"
|
| 71 |
|
| 72 |
-
return redirect(url_for(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
@app.route('/uploads/<path:filename>')
|
| 75 |
def uploaded_file(filename):
|
|
|
|
| 7 |
print("Failed to import analyze_video:", e)
|
| 8 |
def analyze_video(*args, **kwargs):
|
| 9 |
print("Stub analyze_video called.")
|
| 10 |
+
return {
|
| 11 |
+
"plot": "placeholder.jpg",
|
| 12 |
+
"frames": []
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
|
| 16 |
# Force rebuild to use Flask
|
| 17 |
|
|
|
|
| 67 |
print(f"π Saved video to: {filepath}")
|
| 68 |
|
| 69 |
try:
|
| 70 |
+
result_data = analyze_video(filepath, filename, session['user_id'])
|
| 71 |
+
result_image = result_data["plot"]
|
| 72 |
+
frame_images = result_data["frames"]
|
| 73 |
+
|
| 74 |
print(f"β
analyze_video returned: {result_image}")
|
| 75 |
except Exception as e:
|
| 76 |
print(f"β analyze_video failed: {e}")
|
| 77 |
result_image = "placeholder.jpg"
|
| 78 |
|
| 79 |
+
return redirect(url_for(
|
| 80 |
+
'index',
|
| 81 |
+
video_filename=filename,
|
| 82 |
+
result_image=result_image,
|
| 83 |
+
frame_images="|".join(frame_images)
|
| 84 |
+
))
|
| 85 |
|
| 86 |
@app.route('/uploads/<path:filename>')
|
| 87 |
def uploaded_file(filename):
|