# app.py # from flask import Flask,request,jsonify # from flask_cors import CORS from fastapi import FastAPI # loading the data from the csv file to apandas dataframe app = FastAPI() from huggingface_hub import login import os cache_dir = '/tmp/hf_cache' os.makedirs(cache_dir, exist_ok=True) # Login with token from environment # login(token=os.getenv("HF_TOKEN"),cache_dir=cache_dir) # app = Flask(__name__) # cors = CORS(app, resources={r"*": {"origins": "*"}}) from recommendwithhist import recommend_movieswithhistory from recommendwithdesc import recommend_movies_with_desc from recommend_normal import recommend_movies # Define a route for the home page @app.get('/') def hello_world(username: str, movie: str): return recommend_movieswithhistory(username, movie) # Description-based recommendation @app.get('/des') def test(desc: str): return recommend_movies_with_desc([desc]) # Normal movie search @app.get('/search') def normal(movie: str): return recommend_movies(movie) # Run the app if the script is executed directly