SoumyaJ's picture
changes to execute as API
b81311c verified
raw
history blame
678 Bytes
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from programmeRecommendation import recommendProgrammes
import uvicorn
app = FastAPI()
origins = ["*"]
#handle CORS issue
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"]
)
@app.post("/cmsai/recommendmovies")
def recommendMovies(scheduleDate : str, genre: list[str], referenceProgrammeTitle : str):
moviesInRecommendationList = recommendProgrammes(scheduleDate, genre, referenceProgrammeTitle)
return moviesInRecommendationList
if __name__ == '__main__':
uvicorn.run(app= app)