Navanihk commited on
Commit
9dd175d
·
1 Parent(s): 9a005cf
Files changed (1) hide show
  1. app.py +34 -0
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py
2
+
3
+ # from flask import Flask,request,jsonify
4
+ # from flask_cors import CORS
5
+ from fastapi import FastAPI
6
+ # loading the data from the csv file to apandas dataframe
7
+ app = FastAPI()
8
+ from huggingface_hub import login
9
+
10
+ import os
11
+ # Login with token from environment
12
+ login(token=os.getenv("HF_TOKEN"))
13
+ # app = Flask(__name__)
14
+ # cors = CORS(app, resources={r"*": {"origins": "*"}})
15
+ from recommendwithhist import recommend_movieswithhistory
16
+ from recommendwithdesc import recommend_movies_with_desc
17
+ from recommend_normal import recommend_movies
18
+ # Define a route for the home page
19
+
20
+ @app.get('/')
21
+ def hello_world(username: str, movie: str):
22
+ return recommend_movieswithhistory(username, movie)
23
+
24
+ # Description-based recommendation
25
+ @app.get('/des')
26
+ def test(desc: str):
27
+ return recommend_movies_with_desc([desc])
28
+
29
+ # Normal movie search
30
+ @app.get('/search')
31
+ def normal(movie: str):
32
+ return recommend_movies(movie)
33
+ # Run the app if the script is executed directly
34
+