Skip to content

Commit e42e3c6

Browse files
committed
docker
1 parent 57168f9 commit e42e3c6

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Use Python 3.10-slim base image
2+
FROM python:3.10-slim
3+
4+
# Set the working directory in the container
5+
WORKDIR /app
6+
7+
# Install dependencies
8+
COPY requirements.txt .
9+
RUN pip install --no-cache-dir -r requirements.txt
10+
11+
# Copy the rest of the project files into the container
12+
COPY . .
13+
14+
# Expose port 7860 (FastAPI's default port)
15+
EXPOSE 7860
16+
17+
# Run the FastAPI app using Uvicorn
18+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]

app.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ async def health_check():
145145
async def root():
146146
return {"message": "fin_gpt server is running"}
147147

148+
148149
#input is only question
149150
@app.post("/question")
150151
async def find_relevant(request: Request):
@@ -171,6 +172,7 @@ async def find_relevant(request: Request):
171172
return {"error": "No question provided"}, 400
172173

173174
#input is question and pdf file
175+
174176
@app.post("/ask_pdf", response_model=GenerateOut)
175177
async def ask_pdf(question: str = Form(...),pdf: UploadFile = File(...)):
176178
# Step 1: Save the uploaded PDF to a temporary file
@@ -244,6 +246,7 @@ async def run_pipeline(data: QueryIn):
244246
return GenerateOut(gold_inds=gold_inds, program=program, result=str(result))
245247

246248

249+
247250
@app.post("/predict")
248251
async def predict(file: UploadFile = File(...)):
249252
extension = file.filename.split(".")[-1].lower()

utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ def download_and_load_models():
205205
# Ensure directories exist
206206
os.makedirs("models", exist_ok=True)
207207
os.makedirs("data", exist_ok=True)
208-
209208
# Download all required files
210209
for model_name, model_info in model_files.items():
211210
download_model(model_info["file_id"], model_info["output_path"])

0 commit comments

Comments
 (0)