Shujah239 commited on
Commit
84bdc4b
·
verified ·
1 Parent(s): c1568d0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -12,10 +12,6 @@ from transformers import pipeline
12
  import torch
13
  import uvicorn
14
 
15
- @app.get("/")
16
- async def root():
17
- return {"message": "Audio Emotion Detection API", "status": "running"}
18
-
19
  # Configure logging
20
  logging.basicConfig(level=logging.INFO)
21
  logger = logging.getLogger(__name__)
@@ -31,6 +27,11 @@ app = FastAPI(
31
  version="1.0.0",
32
  )
33
 
 
 
 
 
 
34
  # Add middleware
35
  app.add_middleware(
36
  CORSMiddleware,
@@ -268,5 +269,4 @@ async def delete_recording(filename: str):
268
 
269
  if __name__ == "__main__":
270
  # Bind to 0.0.0.0:7860 for Hugging Face Spaces compatibility
271
- import uvicorn
272
- uvicorn.run(app, host="0.0.0.0", port=7860)
 
12
  import torch
13
  import uvicorn
14
 
 
 
 
 
15
  # Configure logging
16
  logging.basicConfig(level=logging.INFO)
17
  logger = logging.getLogger(__name__)
 
27
  version="1.0.0",
28
  )
29
 
30
+ # Add root endpoint AFTER app is defined
31
+ @app.get("/")
32
+ async def root():
33
+ return {"message": "Audio Emotion Detection API", "status": "running"}
34
+
35
  # Add middleware
36
  app.add_middleware(
37
  CORSMiddleware,
 
269
 
270
  if __name__ == "__main__":
271
  # Bind to 0.0.0.0:7860 for Hugging Face Spaces compatibility
272
+ uvicorn.run(app, host="0.0.0.0", port=7860)