amirhosseinkarami commited on
Commit
3558ad8
1 Parent(s): 2518257

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py CHANGED
@@ -1,4 +1,26 @@
1
  import gradio as gr
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  demo = gr.Interface(fn=recom,
4
  inputs=[gr.Dropdown(choices = list(desc['title'][:20]), multiselect=True, max_choices=3, label="Movies"),
 
1
  import gradio as gr
2
+ from Recommender import Recommender
3
+ from Preprocess import ModelUtils, Preprocess
4
+
5
+ data_path = "data"
6
+ model_path = "model_root"
7
+
8
+ data = pd.read_csv(data_path)
9
+
10
+ modelu = ModelUtils(model_path)
11
+ modelu.make_dirs()
12
+ modelu.download_model()
13
+ p = Preprocess("/content")
14
+
15
+ data = pd.read_csv(data_path)
16
+
17
+ rec = Recommender (4, 3, 0)
18
+ k = 3
19
+
20
+ table = [tuple(row) for row in data.to_numpy()]
21
+
22
+ def recom (title) :
23
+ rec.recommend_k(table, k, title)
24
 
25
  demo = gr.Interface(fn=recom,
26
  inputs=[gr.Dropdown(choices = list(desc['title'][:20]), multiselect=True, max_choices=3, label="Movies"),