Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -15,7 +15,7 @@ from fastapi.middleware.cors import CORSMiddleware
|
|
| 15 |
from fastapi.responses import JSONResponse
|
| 16 |
from pydantic import BaseModel
|
| 17 |
|
| 18 |
-
from
|
| 19 |
|
| 20 |
# ================= APP CONFIGURATION =================
|
| 21 |
|
|
@@ -35,7 +35,7 @@ app.add_middleware(
|
|
| 35 |
)
|
| 36 |
|
| 37 |
# Global engine instance
|
| 38 |
-
coach_engine: Optional[
|
| 39 |
|
| 40 |
# Supported audio formats
|
| 41 |
SUPPORTED_FORMATS = {
|
|
@@ -75,7 +75,7 @@ async def startup_event():
|
|
| 75 |
|
| 76 |
try:
|
| 77 |
print("\n📦 Loading AI models...")
|
| 78 |
-
coach_engine =
|
| 79 |
print("✅ Coach engine ready!")
|
| 80 |
print("\n" + "="*60)
|
| 81 |
print("🎤 API is ready to analyze speeches!")
|
|
@@ -198,7 +198,7 @@ async def analyze_speech(file: UploadFile = File(...)):
|
|
| 198 |
detail=result["error"]
|
| 199 |
)
|
| 200 |
|
| 201 |
-
print(f"✅ Analysis complete
|
| 202 |
|
| 203 |
return JSONResponse(content=result)
|
| 204 |
|
|
@@ -270,4 +270,4 @@ if __name__ == "__main__":
|
|
| 270 |
host="0.0.0.0",
|
| 271 |
port=8000,
|
| 272 |
log_level="info"
|
| 273 |
-
)
|
|
|
|
| 15 |
from fastapi.responses import JSONResponse
|
| 16 |
from pydantic import BaseModel
|
| 17 |
|
| 18 |
+
from enhanced_speech_coach import EnhancedPublicSpeakingCoach
|
| 19 |
|
| 20 |
# ================= APP CONFIGURATION =================
|
| 21 |
|
|
|
|
| 35 |
)
|
| 36 |
|
| 37 |
# Global engine instance
|
| 38 |
+
coach_engine: Optional[EnhancedPublicSpeakingCoach] = None
|
| 39 |
|
| 40 |
# Supported audio formats
|
| 41 |
SUPPORTED_FORMATS = {
|
|
|
|
| 75 |
|
| 76 |
try:
|
| 77 |
print("\n📦 Loading AI models...")
|
| 78 |
+
coach_engine = EnhancedPublicSpeakingCoach(whisper_model_size="base")
|
| 79 |
print("✅ Coach engine ready!")
|
| 80 |
print("\n" + "="*60)
|
| 81 |
print("🎤 API is ready to analyze speeches!")
|
|
|
|
| 198 |
detail=result["error"]
|
| 199 |
)
|
| 200 |
|
| 201 |
+
print(f"✅ Analysis complete")
|
| 202 |
|
| 203 |
return JSONResponse(content=result)
|
| 204 |
|
|
|
|
| 270 |
host="0.0.0.0",
|
| 271 |
port=8000,
|
| 272 |
log_level="info"
|
| 273 |
+
)
|