Spaces:
Sleeping
Sleeping
import gradio as gr | |
from Recommender import Recommender | |
from Preprocess import ModelUtils, Preprocess | |
data_path = "data" | |
model_path = "model_root" | |
data = pd.read_csv(data_path) | |
modelu = ModelUtils(model_path) | |
modelu.make_dirs() | |
modelu.download_model() | |
p = Preprocess("/content") | |
data = pd.read_csv(data_path) | |
rec = Recommender (4, 3, 0) | |
k = 3 | |
table = [tuple(row) for row in data.to_numpy()] | |
def recom (title) : | |
rec.recommend_k(table, k, title) | |
demo = gr.Interface(fn=recom, | |
inputs=[gr.Dropdown(choices = list(desc['title'][:20]), multiselect=True, max_choices=3, label="Movies"), | |
gr.Radio(["bert", "scibert", "nltk" , "none"], value="none", label="Tokenization and text preprocess")], | |
outputs=gr.Textbox(label="Recommended")) | |
demo.launch() |