Spaces:
Runtime error
Runtime error
Resolve Movie not found bug
Browse files
app.py
CHANGED
|
@@ -94,7 +94,11 @@ vocabulary_lookup = {token: idx for idx, token in enumerate(vocabulary)}
|
|
| 94 |
movie_embeddings = model.get_layer("item_embeddings").get_weights()[0]
|
| 95 |
|
| 96 |
# Find Related Movies
|
| 97 |
-
movie_titles =
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
|
| 99 |
def find_related_movies(movie_title, k):
|
| 100 |
k = int(k)
|
|
@@ -163,8 +167,8 @@ with demo:
|
|
| 163 |
""")
|
| 164 |
df1 = gr.DataFrame(headers=["title"], datatype=["str"], interactive=False)
|
| 165 |
|
| 166 |
-
|
| 167 |
-
|
| 168 |
"""
|
| 169 |
<h4>Credits</h4>
|
| 170 |
Author: <a href="https://www.linkedin.com/in/khalid-salama-24403144/"> Khalid Salama</a>.<br>
|
|
@@ -172,6 +176,7 @@ with demo:
|
|
| 172 |
Check out the model <a href="https://huggingface.co/keras-io/Node2Vec_MovieLens">here</a>
|
| 173 |
"""
|
| 174 |
)
|
|
|
|
| 175 |
|
| 176 |
btn.click(fn=find_related_movies, inputs=[inp1,inp2], outputs=df1)
|
| 177 |
|
|
|
|
| 94 |
movie_embeddings = model.get_layer("item_embeddings").get_weights()[0]
|
| 95 |
|
| 96 |
# Find Related Movies
|
| 97 |
+
movie_titles = []
|
| 98 |
+
|
| 99 |
+
for uniq_mov_id in rated_movies.movieId.unique():
|
| 100 |
+
movie_title = get_movie_title_by_id(uniq_mov_id)
|
| 101 |
+
movie_titles.append(movie_title)
|
| 102 |
|
| 103 |
def find_related_movies(movie_title, k):
|
| 104 |
k = int(k)
|
|
|
|
| 167 |
""")
|
| 168 |
df1 = gr.DataFrame(headers=["title"], datatype=["str"], interactive=False)
|
| 169 |
|
| 170 |
+
with gr.Row():
|
| 171 |
+
gr.Markdown(
|
| 172 |
"""
|
| 173 |
<h4>Credits</h4>
|
| 174 |
Author: <a href="https://www.linkedin.com/in/khalid-salama-24403144/"> Khalid Salama</a>.<br>
|
|
|
|
| 176 |
Check out the model <a href="https://huggingface.co/keras-io/Node2Vec_MovieLens">here</a>
|
| 177 |
"""
|
| 178 |
)
|
| 179 |
+
|
| 180 |
|
| 181 |
btn.click(fn=find_related_movies, inputs=[inp1,inp2], outputs=df1)
|
| 182 |
|