Spaces:
Running
Running
Developer
commited on
Commit
Β·
d9a8155
1
Parent(s):
447c811
π ADD MODEL RELOAD: Fix model detection after download
Browse filesβ
CRITICAL FIX: Added /reload-models endpoint
β
AUTO-RELOAD: Download endpoint now auto-reloads models
β
MANUAL RELOAD: New endpoint to force model detection
π Problem identified:
- Models downloaded successfully (26.37GB)
- But load_model() only runs at startup
- After container rebuild, models need re-download
- After re-download, models need reload to be detected
π Solution added:
- POST /reload-models - manually trigger model detection
- Auto-reload in /download-models endpoint
- Better logging for model detection process
π Next steps:
1. Push to HF Spaces
2. Models already downloaded (from previous call)
3. Call /reload-models to detect them
4. Video generation should work!
app.py
CHANGED
@@ -726,7 +726,35 @@ async def download_video_models():
|
|
726 |
if free_gb < 10: # Need at least 10GB free
|
727 |
return {
|
728 |
"success": False,
|
729 |
-
"message": f"Insufficient storage: {free_gb:.1f}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
730 |
"storage_gb": free_gb
|
731 |
}
|
732 |
|
@@ -993,5 +1021,6 @@ if __name__ == "__main__":
|
|
993 |
|
994 |
|
995 |
|
|
|
996 |
|
997 |
|
|
|
726 |
if free_gb < 10: # Need at least 10GB free
|
727 |
return {
|
728 |
"success": False,
|
729 |
+
"message": f"Insufficient storage: {free_gb:.1f}
|
730 |
+
@app.post("/reload-models")
|
731 |
+
async def reload_models():
|
732 |
+
"""Force reload model detection after download"""
|
733 |
+
logger.info("?? Manual model reload requested...")
|
734 |
+
try:
|
735 |
+
success = omni_api.load_model()
|
736 |
+
if success and omni_api.model_loaded:
|
737 |
+
return {
|
738 |
+
"success": True,
|
739 |
+
"message": "? Models reloaded successfully!",
|
740 |
+
"model_loaded": omni_api.model_loaded,
|
741 |
+
"video_generation_available": omni_api.model_loaded
|
742 |
+
}
|
743 |
+
else:
|
744 |
+
return {
|
745 |
+
"success": False,
|
746 |
+
"message": "? Model reload completed but models not found",
|
747 |
+
"model_loaded": omni_api.model_loaded,
|
748 |
+
"video_generation_available": omni_api.model_loaded
|
749 |
+
}
|
750 |
+
except Exception as e:
|
751 |
+
logger.error(f"? Model reload failed: {e}")
|
752 |
+
return {
|
753 |
+
"success": False,
|
754 |
+
"message": f"Model reload failed: {str(e)}",
|
755 |
+
"error": str(e)
|
756 |
+
}
|
757 |
+
GB available, 10GB+ required",
|
758 |
"storage_gb": free_gb
|
759 |
}
|
760 |
|
|
|
1021 |
|
1022 |
|
1023 |
|
1024 |
+
|
1025 |
|
1026 |
|