MahmoudElsamadony commited on
Commit
e79a4f5
·
1 Parent(s): e3ff092
Files changed (4) hide show
  1. Dockerfile +4 -1
  2. nginx.conf +15 -2
  3. requirements.txt +1 -0
  4. start.sh +2 -2
Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM python:3.10-slim
2
 
3
  WORKDIR /app
4
 
@@ -6,6 +6,9 @@ WORKDIR /app
6
  RUN apt-get update && apt-get install -y \
7
  espeak-ng \
8
  nginx \
 
 
 
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
  COPY requirements.txt .
 
1
+ FROM python:3.11-slim
2
 
3
  WORKDIR /app
4
 
 
6
  RUN apt-get update && apt-get install -y \
7
  espeak-ng \
8
  nginx \
9
+ git \
10
+ build-essential \
11
+ libsndfile1 \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
  COPY requirements.txt .
nginx.conf CHANGED
@@ -20,13 +20,23 @@ http {
20
  listen 7860;
21
  server_name localhost;
22
 
 
 
 
23
  # Route /api requests to FastAPI
24
- location /api/ {
25
- proxy_pass http://127.0.0.1:8000/;
 
 
 
 
26
  proxy_set_header Host $host;
27
  proxy_set_header X-Real-IP $remote_addr;
28
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
29
  proxy_set_header X-Forwarded-Proto $scheme;
 
 
 
30
  }
31
 
32
  # Route everything else to Streamlit
@@ -42,6 +52,9 @@ http {
42
  proxy_set_header Upgrade $http_upgrade;
43
  proxy_set_header Connection "upgrade";
44
  proxy_read_timeout 86400;
 
 
 
45
  }
46
  }
47
  }
 
20
  listen 7860;
21
  server_name localhost;
22
 
23
+ # Increase body size for audio uploads if needed
24
+ client_max_body_size 50M;
25
+
26
  # Route /api requests to FastAPI
27
+ # Using ^~ to ensure this block takes precedence
28
+ location ^~ /api/ {
29
+ # Rewrite /api/xyz to /xyz
30
+ rewrite ^/api/(.*) /$1 break;
31
+
32
+ proxy_pass http://127.0.0.1:8000;
33
  proxy_set_header Host $host;
34
  proxy_set_header X-Real-IP $remote_addr;
35
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
36
  proxy_set_header X-Forwarded-Proto $scheme;
37
+
38
+ # Debug header
39
+ add_header X-Backend "FastAPI";
40
  }
41
 
42
  # Route everything else to Streamlit
 
52
  proxy_set_header Upgrade $http_upgrade;
53
  proxy_set_header Connection "upgrade";
54
  proxy_read_timeout 86400;
55
+
56
+ # Debug header
57
+ add_header X-Backend "Streamlit";
58
  }
59
  }
60
  }
requirements.txt CHANGED
@@ -10,3 +10,4 @@ datasets>=2.19.0
10
  sentencepiece>=0.2.0
11
  fastapi
12
  uvicorn
 
 
10
  sentencepiece>=0.2.0
11
  fastapi
12
  uvicorn
13
+ TTS
start.sh CHANGED
@@ -1,8 +1,8 @@
1
  #!/bin/bash
2
 
3
  # Start FastAPI in the background
4
- # We set root-path to /api so Swagger UI works correctly behind the proxy
5
- uvicorn api_server:app --host 0.0.0.0 --port 8000 --root-path /api &
6
 
7
  # Start Streamlit in the background
8
  streamlit run app.py --server.port 8501 --server.address 0.0.0.0 &
 
1
  #!/bin/bash
2
 
3
  # Start FastAPI in the background
4
+ # Removed --root-path since Nginx now handles the rewrite
5
+ uvicorn api_server:app --host 0.0.0.0 --port 8000 &
6
 
7
  # Start Streamlit in the background
8
  streamlit run app.py --server.port 8501 --server.address 0.0.0.0 &