taslim19 commited on
Commit
98de9a2
·
1 Parent(s): a9b26b7

Clean up server setup - remove duplicate FastAPI server

Browse files
Files changed (2) hide show
  1. server.py +6 -1
  2. start.sh +1 -4
server.py CHANGED
@@ -1,12 +1,17 @@
1
  import os
2
  import uvicorn
3
  from fastapi import FastAPI
 
4
 
5
  app = FastAPI(docs_url=None, redoc_url="/")
6
 
 
 
 
 
7
  @app.get("/status")
8
  def hello():
9
- return {"message": "running"}
10
 
11
  if __name__ == "__main__":
12
  uvicorn.run(app, host="0.0.0.0", port=7860)
 
1
  import os
2
  import uvicorn
3
  from fastapi import FastAPI
4
+ from fastapi.responses import RedirectResponse
5
 
6
  app = FastAPI(docs_url=None, redoc_url="/")
7
 
8
+ @app.get("/")
9
+ def redirect_to_oneapi():
10
+ return RedirectResponse(url="http://localhost:8080/")
11
+
12
  @app.get("/status")
13
  def hello():
14
+ return {"message": "OneApi is running on port 8080", "oneapi_url": "http://localhost:8080/"}
15
 
16
  if __name__ == "__main__":
17
  uvicorn.run(app, host="0.0.0.0", port=7860)
start.sh CHANGED
@@ -1,7 +1,4 @@
1
  #!/bin/bash
2
 
3
- # Start server.py in the background
4
- python server.py &
5
-
6
- # Start OneApi (in the foreground to keep container running)
7
  python -m OneApi
 
1
  #!/bin/bash
2
 
3
+ # Start OneApi (main application)
 
 
 
4
  python -m OneApi