FredyHoundayi commited on
Commit
0a0ce40
·
1 Parent(s): 99f98f2

Fix Hugging Face Spaces: add main.py at root and change port to 7860

Browse files
Files changed (3) hide show
  1. Dockerfile +2 -2
  2. app/main.py +8 -0
  3. main.py +5 -0
Dockerfile CHANGED
@@ -41,7 +41,7 @@ RUN adduser --disabled-password --gecos '' appuser \
41
  USER appuser
42
 
43
  # Expose port
44
- EXPOSE 8000
45
 
46
  # Run the application
47
- CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
 
41
  USER appuser
42
 
43
  # Expose port
44
+ EXPOSE 7860
45
 
46
  # Run the application
47
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
app/main.py CHANGED
@@ -10,3 +10,11 @@ app.mount("/static", StaticFiles(directory="app/static"), name="static")
10
  app.include_router(chat.router)
11
  app.include_router(quiz.router)
12
  app.include_router(audio.router)
 
 
 
 
 
 
 
 
 
10
  app.include_router(chat.router)
11
  app.include_router(quiz.router)
12
  app.include_router(audio.router)
13
+
14
+ @app.get("/")
15
+ async def root():
16
+ return {"status": "healthy", "message": "JANGG AI API is running"}
17
+
18
+ @app.get("/health")
19
+ async def health_check():
20
+ return {"status": "healthy"}
main.py ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ from app.main import app
2
+
3
+ if __name__ == "__main__":
4
+ import uvicorn
5
+ uvicorn.run(app, host="0.0.0.0", port=7860)