JJTsao commited on
Commit
cb0afeb
·
verified ·
1 Parent(s): ef8e8f9

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +19 -0
  2. main.py +22 -0
  3. requirements.txt +26 -0
Dockerfile ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a slim Python base image
2
+ FROM python:3.10-slim
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Install Python dependencies
8
+ COPY requirements.txt .
9
+ RUN pip install --no-cache-dir -r requirements.txt
10
+
11
+ # Copy all project files into the container
12
+ COPY . .
13
+
14
+ # Set environment to unbuffered (cleaner logs)
15
+ ENV PYTHONUNBUFFERED=1
16
+
17
+ # Run FastAPI app on port 7860 (required by HF Spaces)
18
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
19
+
main.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from app.api_routes import router
2
+
3
+ from fastapi import FastAPI
4
+ from fastapi.middleware.cors import CORSMiddleware
5
+
6
+ app = FastAPI()
7
+
8
+ app.add_middleware(
9
+ CORSMiddleware,
10
+ allow_origins=["*"], # Update with frontend domain in prod
11
+ allow_credentials=True,
12
+ allow_methods=["*"],
13
+ allow_headers=["*"],
14
+ )
15
+
16
+
17
+ app.include_router(router)
18
+
19
+
20
+ @app.get("/health")
21
+ def health_check():
22
+ return {"status": "ok"}
requirements.txt ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Web framework
2
+ fastapi==0.115.12
3
+ uvicorn[standard]==0.34.2
4
+
5
+ # HTTP client
6
+ httpx==0.28.1
7
+ openai==1.82.0
8
+
9
+ # Transformers & Hugging Face tools
10
+ transformers==4.52.3
11
+ sentence-transformers==4.1.0
12
+
13
+ # Vector DB
14
+ qdrant-client==1.14.2
15
+
16
+ # Caching, file IO, progress
17
+ tqdm==4.67.1
18
+ joblib==1.5.0
19
+ python-dotenv==1.1.0
20
+
21
+ # NLTK for BM25 and query preprocessing
22
+ nltk==3.9.1
23
+ rank-bm25==0.2.2
24
+
25
+ # Typing for Python 3.10+
26
+ typing_extensions>=4.13.2