Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,18 +14,9 @@ def recommend_movie(movie):
|
|
| 14 |
idx = dls.classes['original_title'].o2i[movie]
|
| 15 |
distances = nn.CosineSimilarity(dim=1)(movie_factors, movie_factors[idx][None])
|
| 16 |
idx = distances.argsort(descending=True)[1:6]
|
| 17 |
-
dls.classes['original_title'][idx]
|
| 18 |
|
| 19 |
input_txt = gr.Textbox()
|
| 20 |
-
|
| 21 |
-
# recommendations = get_recommendations(0)
|
| 22 |
-
gr.Markdown(
|
| 23 |
-
"""
|
| 24 |
-
### Output
|
| 25 |
-
#### Top 10 movie recommendations
|
| 26 |
-
""")
|
| 27 |
-
out_text = gr.DataFrame(headers=["title"], datatype=["str"], interactive=False)
|
| 28 |
-
|
| 29 |
-
#out_text = gr.Textbox()
|
| 30 |
intf = gr.Interface(fn=recommend_movie, inputs=input_txt, outputs=[out_text])
|
| 31 |
intf.launch(inline=False)
|
|
|
|
| 14 |
idx = dls.classes['original_title'].o2i[movie]
|
| 15 |
distances = nn.CosineSimilarity(dim=1)(movie_factors, movie_factors[idx][None])
|
| 16 |
idx = distances.argsort(descending=True)[1:6]
|
| 17 |
+
return dls.classes['original_title'][idx]
|
| 18 |
|
| 19 |
input_txt = gr.Textbox()
|
| 20 |
+
out_text = gr.Textbox()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
intf = gr.Interface(fn=recommend_movie, inputs=input_txt, outputs=[out_text])
|
| 22 |
intf.launch(inline=False)
|