jchen8000 commited on
Commit
eb62f95
·
verified ·
1 Parent(s): 8b72576

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -56,12 +56,9 @@ def recommend_movies(movie):
56
  max_length = movies['title'].str.len().max()
57
  print(f"The longest movie name length is: {max_length}")
58
 
59
- # headers = "Title{:20}Score".format("")
60
- # return headers + "\n" + "\n".join([f"{title:<20} {score:>5.2f}" for title, score in recommendations])
61
 
62
- format_string = f"{{:<{max_length}}}: {{:>5.2f}}"
63
- return "Title" + " " * (max_length - 5) + "Score\n" + "\n".join([format_string.format(title, score) for title, score in recommendations])
64
-
65
 
66
  # Create the Gradio interface
67
  movie_list = movies['title'].tolist()
 
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:>5.2f} {title:<20} " for title, score in recommendations])
61
 
 
 
 
62
 
63
  # Create the Gradio interface
64
  movie_list = movies['title'].tolist()