mohammedafeef commited on
Commit
1dd8eaf
·
verified ·
1 Parent(s): a374eb5

Update server.py

Browse files
Files changed (1) hide show
  1. server.py +10 -4
server.py CHANGED
@@ -11,17 +11,21 @@ from groq import Groq
11
  from dotenv import load_dotenv
12
  import librosa
13
  import soundfile as sf
14
- from main2 import UnifiedAudioAnalyzer, summarize_audio_analysis_with_llm
15
 
16
  # Load environment variables
17
  load_dotenv()
18
 
19
  app = FastAPI(title="Audio Analysis API", version="1.0.0")
20
 
21
- # CORS middleware
22
  app.add_middleware(
23
  CORSMiddleware,
24
- allow_origins=["http://localhost:9002", "http://localhost:3000"], # Frontend URLs
 
 
 
 
 
25
  allow_credentials=True,
26
  allow_methods=["*"],
27
  allow_headers=["*"],
@@ -183,4 +187,6 @@ async def health_check():
183
  return {"status": "healthy", "analyzer_loaded": analyzer is not None}
184
 
185
  if __name__ == "__main__":
186
- uvicorn.run(app, host="0.0.0.0", port=8000)
 
 
 
11
  from dotenv import load_dotenv
12
  import librosa
13
  import soundfile as sf
14
+ from main import UnifiedAudioAnalyzer, summarize_audio_analysis_with_llm
15
 
16
  # Load environment variables
17
  load_dotenv()
18
 
19
  app = FastAPI(title="Audio Analysis API", version="1.0.0")
20
 
 
21
  app.add_middleware(
22
  CORSMiddleware,
23
+ allow_origins=[
24
+ "http://localhost:9002",
25
+ "http://localhost:3000",
26
+ "https://alm-frontend-dusky.vercel.app/",
27
+ "*"
28
+ ],
29
  allow_credentials=True,
30
  allow_methods=["*"],
31
  allow_headers=["*"],
 
187
  return {"status": "healthy", "analyzer_loaded": analyzer is not None}
188
 
189
  if __name__ == "__main__":
190
+ import os
191
+ port = int(os.getenv("PORT", 7860))
192
+ uvicorn.run(app, host="0.0.0.0", port=port)