jchen8000 commited on
Commit
693eb08
·
verified ·
1 Parent(s): 3df8b3e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -52,13 +52,9 @@ def get_recommendations(title, cosine_sim=cosine_sim):
52
  # Gradio interface
53
  def recommend_movies(movie):
54
  recommendations = get_recommendations(movie)
55
-
56
- max_length = movies['title'].str.len().max()
57
- print(f"The longest movie name length is: {max_length}")
58
-
59
- headers = "Score{:10}Title".format("")
60
- return headers + "\n" + "\n".join([f"{score:>10.2f} {title:<20} " for title, score in recommendations])
61
-
62
 
63
  # Create the Gradio interface
64
  movie_list = movies['title'].tolist()
 
52
  # Gradio interface
53
  def recommend_movies(movie):
54
  recommendations = get_recommendations(movie)
55
+
56
+ format_string = "{:>5.2f} {:<20}"
57
+ return "Score Title\n" + "\n".join([format_string.format(score, title) for title, score in recommendations])
 
 
 
 
58
 
59
  # Create the Gradio interface
60
  movie_list = movies['title'].tolist()