saq1b commited on
Commit
ed30b5b
1 Parent(s): 1ed92ae

Upload 6 files

Browse files
Files changed (3) hide show
  1. Dockerfile +3 -3
  2. main.py +2 -2
  3. start.sh +1 -1
Dockerfile CHANGED
@@ -4,8 +4,8 @@ FROM python:latest
4
  # Set environment variable to avoid buffering issues
5
  ENV PYTHONUNBUFFERED 1
6
 
7
- # Make port 8000 available to the world outside this container
8
- EXPOSE 8000
9
 
10
  # Update apt and install curl
11
  RUN apt update && apt install -y curl
@@ -44,4 +44,4 @@ RUN npm run build
44
  RUN chmod +x start.sh
45
 
46
  # Set the default command to run the start script
47
- CMD ["./start.sh"]
 
4
  # Set environment variable to avoid buffering issues
5
  ENV PYTHONUNBUFFERED 1
6
 
7
+ # Make port 7860 available to the world outside this container
8
+ EXPOSE 7860
9
 
10
  # Update apt and install curl
11
  RUN apt update && apt install -y curl
 
44
  RUN chmod +x start.sh
45
 
46
  # Set the default command to run the start script
47
+ CMD ["./start.sh"]
main.py CHANGED
@@ -25,7 +25,7 @@ async def stream_response(response):
25
  for chunk in response:
26
  yield chunk.text
27
 
28
- @app.post("/think")
29
  async def think(request: ChatRequest):
30
  api_key = request.api_key or os.getenv("GOOGLE_API_KEY")
31
  if not api_key:
@@ -52,7 +52,7 @@ async def think(request: ChatRequest):
52
  response = await model.generate_content_async(messages, stream=True)
53
  return StreamingResponse(stream_response(response), media_type="text/plain")
54
 
55
- @app.post("/chat")
56
  async def chat(request: ChatRequest):
57
  api_key = request.api_key or os.getenv("GOOGLE_API_KEY")
58
  if not api_key:
 
25
  for chunk in response:
26
  yield chunk.text
27
 
28
+ @app.post("/api/think")
29
  async def think(request: ChatRequest):
30
  api_key = request.api_key or os.getenv("GOOGLE_API_KEY")
31
  if not api_key:
 
52
  response = await model.generate_content_async(messages, stream=True)
53
  return StreamingResponse(stream_response(response), media_type="text/plain")
54
 
55
+ @app.post("/api/chat")
56
  async def chat(request: ChatRequest):
57
  api_key = request.api_key or os.getenv("GOOGLE_API_KEY")
58
  if not api_key:
start.sh CHANGED
@@ -5,7 +5,7 @@ set -e
5
  npm start &
6
 
7
  # Start the FastAPI backend
8
- uvicorn main:app --host 0.0.0.0 --port 8000
9
 
10
  # Wait for any process to exit
11
  wait -n
 
5
  npm start &
6
 
7
  # Start the FastAPI backend
8
+ python main.py &
9
 
10
  # Wait for any process to exit
11
  wait -n