bpHigh commited on
Commit
4cd9189
1 Parent(s): 2584a60

Resolve Movie not found bug

Browse files
Files changed (1) hide show
  1. app.py +8 -3
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 = list(movies['title'])
 
 
 
 
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
- with gr.Row():
167
- gr.Markdown(
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