From a8b3957ef6ddff798c470873b287e23c73f0ca20 Mon Sep 17 00:00:00 2001 From: Archit Date: Fri, 13 Jun 2025 10:36:58 +0000 Subject: [PATCH] requires changes for vercel --- api.py => api/index.py | 4 ++++ requirements.txt | 3 ++- vercel.json | 14 ++++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) rename api.py => api/index.py (98%) diff --git a/api.py b/api/index.py similarity index 98% rename from api.py rename to api/index.py index 4592c7f..3ee7c33 100644 --- a/api.py +++ b/api/index.py @@ -4,6 +4,7 @@ ## dependencies from fastapi import FastAPI, Depends from fastapi.responses import JSONResponse +from mangum import Mangum from typing import Annotated, Dict from model.ESP import predict_exam_score, VERSION, NAME @@ -99,4 +100,7 @@ def predict(user_input_data: Annotated[StudentInputDetails, Depends()]) -> JSONR +handler = Mangum(app) + + diff --git a/requirements.txt b/requirements.txt index ac6e257..584d3d2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,5 @@ scikit-learn==1.2.2 uvicorn==0.34.2 pandas==2.2.3 fastapi==0.115.12 -numpy==1.26.4 \ No newline at end of file +numpy==1.26.4 +mangum \ No newline at end of file diff --git a/vercel.json b/vercel.json index ba0596d..bfbe8f4 100644 --- a/vercel.json +++ b/vercel.json @@ -1,9 +1,15 @@ { "version": 2, + "builds": [ + { + "src": "api/index.py", + "use": "@vercel/python" + } + ], "routes": [ - { - "src": "/(.*)", - "dest": "app.py" + { + "src": "/(.*)", + "dest": "api/index.py" } ] -} +} \ No newline at end of file