AmirShabani
commited on
Commit
•
308787f
1
Parent(s):
34ffe42
Update app.py
Browse files
app.py
CHANGED
@@ -106,25 +106,25 @@ def display_movie(movie, rating):
|
|
106 |
|
107 |
global user_input
|
108 |
data = get_data(movie)
|
109 |
-
if data['status'] == True:
|
110 |
user_input[f"{data['title']} ({data['year']})"] = rating
|
111 |
poster = get_poster(data['title'])
|
112 |
|
113 |
-
|
114 |
-
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
# Return the output
|
122 |
-
return f"Your movies are ready!\nPlease check the recommendations below.", np.zeros((500, 500, 3)), html_code
|
123 |
-
|
124 |
-
elif data['status'] == True:
|
125 |
-
|
126 |
-
# Return the input movie name and poster
|
127 |
-
return f"You entered {movie} with rating {rating}", poster, ""
|
128 |
else:
|
129 |
return f"we can't find {movie} please try again", np.zeros((500, 500, 3)), ""
|
130 |
|
|
|
106 |
|
107 |
global user_input
|
108 |
data = get_data(movie)
|
109 |
+
if data['status'] == 'True':
|
110 |
user_input[f"{data['title']} ({data['year']})"] = rating
|
111 |
poster = get_poster(data['title'])
|
112 |
|
113 |
+
if len(user_input) == 5:
|
114 |
+
# Get the recommended movies from the input
|
115 |
+
r_movies, r_posters = get_recommendations(user_input)
|
116 |
+
|
117 |
+
# Create a list with a list of HTML strings with information
|
118 |
+
html_code = generate_table(r_movies, r_posters)
|
119 |
+
|
120 |
+
user_input = {}
|
121 |
+
# Return the output
|
122 |
+
return f"Your movies are ready!\nPlease check the recommendations below.", np.zeros((500, 500, 3)), html_code
|
123 |
|
124 |
+
else:
|
125 |
+
|
126 |
+
# Return the input movie name and poster
|
127 |
+
return f"You entered {movie} with rating {rating}", poster, ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
else:
|
129 |
return f"we can't find {movie} please try again", np.zeros((500, 500, 3)), ""
|
130 |
|