File size: 801 Bytes
bd201c2
3558ad8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bd201c2
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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()