Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -92,7 +92,7 @@ def fetch_and_plot_average_rating_by_genre(conn):
|
|
92 |
|
93 |
fig = px.box(df, x='first_genre', y='averageRating',
|
94 |
labels={'first_genre': 'Genre', 'averageRating': 'Average Rating'},
|
95 |
-
title='Average Rating of Movies by
|
96 |
color='first_genre',
|
97 |
color_discrete_map=genre_color_map)
|
98 |
return fig
|
@@ -141,7 +141,7 @@ def find_best_movies_by_genre(conn):
|
|
141 |
|
142 |
def plot_stacked_genre_movie_releases(genre_counts):
|
143 |
fig = px.area(genre_counts, x='startYear', y='count', color='genres',
|
144 |
-
title='
|
145 |
labels={'startYear': 'Year', 'count': 'Number of Movies', 'genres': 'Genre'},
|
146 |
line_group='genres', # This groups lines by genre
|
147 |
hover_name='genres', # This sets the genre as the hover label
|
@@ -264,7 +264,7 @@ def plot_global_map(conn):
|
|
264 |
color='most_common_genre',
|
265 |
hover_name='region',
|
266 |
hover_data={'region': False, 'most_common_genre': True},
|
267 |
-
title='Most
|
268 |
color_discrete_map=genre_color_map,
|
269 |
)
|
270 |
|
@@ -315,15 +315,15 @@ def run_app():
|
|
315 |
|
316 |
with col1:
|
317 |
st.subheader('Total Movies')
|
318 |
-
st.metric(label='
|
319 |
|
320 |
with col2:
|
321 |
st.subheader('Total Years of Movie Data')
|
322 |
-
st.metric(label='
|
323 |
|
324 |
with col3:
|
325 |
st.subheader('Average Movie Rating')
|
326 |
-
st.metric(label='
|
327 |
|
328 |
# Find and display best movies by genre
|
329 |
best_movies_by_genre = find_best_movies_by_genre(conn)
|
|
|
92 |
|
93 |
fig = px.box(df, x='first_genre', y='averageRating',
|
94 |
labels={'first_genre': 'Genre', 'averageRating': 'Average Rating'},
|
95 |
+
title='Average Rating of Movies by Genre',
|
96 |
color='first_genre',
|
97 |
color_discrete_map=genre_color_map)
|
98 |
return fig
|
|
|
141 |
|
142 |
def plot_stacked_genre_movie_releases(genre_counts):
|
143 |
fig = px.area(genre_counts, x='startYear', y='count', color='genres',
|
144 |
+
title=' Movie Releases by Year',
|
145 |
labels={'startYear': 'Year', 'count': 'Number of Movies', 'genres': 'Genre'},
|
146 |
line_group='genres', # This groups lines by genre
|
147 |
hover_name='genres', # This sets the genre as the hover label
|
|
|
264 |
color='most_common_genre',
|
265 |
hover_name='region',
|
266 |
hover_data={'region': False, 'most_common_genre': True},
|
267 |
+
title='Most Popular Genre around the world',
|
268 |
color_discrete_map=genre_color_map,
|
269 |
)
|
270 |
|
|
|
315 |
|
316 |
with col1:
|
317 |
st.subheader('Total Movies')
|
318 |
+
st.metric(label='', value=total_movies)
|
319 |
|
320 |
with col2:
|
321 |
st.subheader('Total Years of Movie Data')
|
322 |
+
st.metric(label='', value=total_years)
|
323 |
|
324 |
with col3:
|
325 |
st.subheader('Average Movie Rating')
|
326 |
+
st.metric(label='', value=f'{avg_rating:.2f}')
|
327 |
|
328 |
# Find and display best movies by genre
|
329 |
best_movies_by_genre = find_best_movies_by_genre(conn)
|