|
|
|
|
|
|
|
|
|
from fastapi import FastAPI |
|
|
|
app = FastAPI() |
|
from huggingface_hub import login |
|
|
|
import os |
|
cache_dir = '/tmp/hf_cache' |
|
os.makedirs(cache_dir, exist_ok=True) |
|
|
|
|
|
|
|
|
|
from recommendwithhist import recommend_movieswithhistory |
|
from recommendwithdesc import recommend_movies_with_desc |
|
from recommend_normal import recommend_movies |
|
|
|
|
|
@app.get('/') |
|
def hello_world(username: str, movie: str): |
|
return recommend_movieswithhistory(username, movie) |
|
|
|
|
|
@app.get('/des') |
|
def test(desc: str): |
|
return recommend_movies_with_desc([desc]) |
|
|
|
|
|
@app.get('/search') |
|
def normal(movie: str): |
|
return recommend_movies(movie) |
|
|
|
|
|
|