Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -129,7 +129,7 @@ def create_genre_wordcloud(conn):
|
|
129 |
plt.imshow(wordcloud, interpolation='bilinear')
|
130 |
plt.axis('off')
|
131 |
plt.title('Top Genres in IMDb Dataset')
|
132 |
-
st.pyplot()
|
133 |
|
134 |
# Function to find best movie of each genre by numVotes * averageRating
|
135 |
def find_best_movies_by_genre(conn):
|
@@ -157,15 +157,27 @@ def find_best_movies_by_genre(conn):
|
|
157 |
# Main function to orchestrate the dashboard
|
158 |
def main():
|
159 |
# Load data from SQLite database
|
160 |
-
db_file = 'imdb_data.db' # Adjust path as needed
|
161 |
conn = load_data(db_file)
|
162 |
|
163 |
# Fetch and display summary info
|
164 |
total_movies, total_years, avg_rating = fetch_summary_info(conn)
|
165 |
-
|
|
|
166 |
st.write("# IMDb Dashboard")
|
167 |
st.write("## Summary Information")
|
168 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
169 |
|
170 |
# Display global map of total films per region
|
171 |
df_movie_region = pd.read_csv('movie_region.csv') # Replace with your actual CSV loading
|
|
|
129 |
plt.imshow(wordcloud, interpolation='bilinear')
|
130 |
plt.axis('off')
|
131 |
plt.title('Top Genres in IMDb Dataset')
|
132 |
+
st.pyplot(plt.gcf()) # Pass the current figure explicitly to st.pyplot()
|
133 |
|
134 |
# Function to find best movie of each genre by numVotes * averageRating
|
135 |
def find_best_movies_by_genre(conn):
|
|
|
157 |
# Main function to orchestrate the dashboard
|
158 |
def main():
|
159 |
# Load data from SQLite database
|
160 |
+
db_file = 'imdb_data/imdb_data.db' # Adjust path as needed
|
161 |
conn = load_data(db_file)
|
162 |
|
163 |
# Fetch and display summary info
|
164 |
total_movies, total_years, avg_rating = fetch_summary_info(conn)
|
165 |
+
|
166 |
+
# Display summary information in three columns
|
167 |
st.write("# IMDb Dashboard")
|
168 |
st.write("## Summary Information")
|
169 |
+
|
170 |
+
# Layout the summary information in three columns with big bold numbers
|
171 |
+
col1, col2, col3 = st.columns(3)
|
172 |
+
with col1:
|
173 |
+
st.subheader("Total Movies")
|
174 |
+
st.markdown(f"**{total_movies}**")
|
175 |
+
with col2:
|
176 |
+
st.subheader("Total Years")
|
177 |
+
st.markdown(f"**{total_years}**")
|
178 |
+
with col3:
|
179 |
+
st.subheader("Average Rating")
|
180 |
+
st.markdown(f"**{avg_rating:.2f}**")
|
181 |
|
182 |
# Display global map of total films per region
|
183 |
df_movie_region = pd.read_csv('movie_region.csv') # Replace with your actual CSV loading
|