Spaces:
Running
Running
Fix: Final bulletproof video pipeline with whisper and full fallbacks
Browse files- app/services/video_pipeline.py +14 -2
- requirements.txt +1 -0
app/services/video_pipeline.py
CHANGED
|
@@ -40,18 +40,30 @@ def get_video_module(name: str):
|
|
| 40 |
return _video_modules[name]
|
| 41 |
except Exception as e:
|
| 42 |
print(f" [FAIL] Failed to load module '{name}': {e}", flush=True)
|
| 43 |
-
|
|
|
|
|
|
|
| 44 |
print(f" [WARM] Using dummy fallback for '{name}' to avoid pipeline crash.")
|
| 45 |
if name == "reasoning":
|
| 46 |
class DummyReasoning:
|
| 47 |
def analyze_physics(self, *args, **kwargs):
|
| 48 |
return {"score": 0.5, "reasoning": "Reasoning engine unavailable (Load Error)."}
|
| 49 |
_video_modules[name] = DummyReasoning()
|
| 50 |
-
|
| 51 |
class DummyClip:
|
| 52 |
def get_signal(self, *args, **kwargs):
|
| 53 |
return {"score": 0.5, "timeline": [], "max_spike": 0.5}
|
| 54 |
_video_modules[name] = DummyClip()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
return _video_modules[name]
|
| 56 |
raise e
|
| 57 |
|
|
|
|
| 40 |
return _video_modules[name]
|
| 41 |
except Exception as e:
|
| 42 |
print(f" [FAIL] Failed to load module '{name}': {e}", flush=True)
|
| 43 |
+
# Final "Bulletproof" Fallback System
|
| 44 |
+
fallbacks = ["reasoning", "clip", "audio", "tempo"]
|
| 45 |
+
if name in fallbacks:
|
| 46 |
print(f" [WARM] Using dummy fallback for '{name}' to avoid pipeline crash.")
|
| 47 |
if name == "reasoning":
|
| 48 |
class DummyReasoning:
|
| 49 |
def analyze_physics(self, *args, **kwargs):
|
| 50 |
return {"score": 0.5, "reasoning": "Reasoning engine unavailable (Load Error)."}
|
| 51 |
_video_modules[name] = DummyReasoning()
|
| 52 |
+
elif name == "clip":
|
| 53 |
class DummyClip:
|
| 54 |
def get_signal(self, *args, **kwargs):
|
| 55 |
return {"score": 0.5, "timeline": [], "max_spike": 0.5}
|
| 56 |
_video_modules[name] = DummyClip()
|
| 57 |
+
elif name == "audio":
|
| 58 |
+
class DummyAudio:
|
| 59 |
+
def analyze_audio_visual(self, *args, **kwargs):
|
| 60 |
+
return {"score": 0.5, "lip_timeline": [], "audio_speaking": []}
|
| 61 |
+
_video_modules[name] = DummyAudio()
|
| 62 |
+
elif name == "tempo":
|
| 63 |
+
class DummyTempo:
|
| 64 |
+
def get_signal(self, *args, **kwargs):
|
| 65 |
+
return {"score": 0.5, "mag_timeline": [], "evidence_heatmap": None}
|
| 66 |
+
_video_modules[name] = DummyTempo()
|
| 67 |
return _video_modules[name]
|
| 68 |
raise e
|
| 69 |
|
requirements.txt
CHANGED
|
@@ -43,3 +43,4 @@ protobuf~=4.25.3
|
|
| 43 |
python-magic
|
| 44 |
reportlab
|
| 45 |
sentencepiece
|
|
|
|
|
|
| 43 |
python-magic
|
| 44 |
reportlab
|
| 45 |
sentencepiece
|
| 46 |
+
openai-whisper
|