Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import streamlit as st
|
2 |
import pandas as pd
|
|
|
3 |
from apify_client import ApifyClient
|
4 |
import requests
|
5 |
|
@@ -42,28 +43,27 @@ if website_name:
|
|
42 |
st.write(f"**Location:** {lat}, {lng}")
|
43 |
st.write(f"**Temperature:** {temp_in_celsius:.2f}°C")
|
44 |
st.write(f"**Weather:** {current_weather.get('weather')[0].get('description')}")
|
45 |
-
|
46 |
-
#
|
47 |
st.subheader("Occupancy Data")
|
48 |
occupancy_data = google_maps_data.get('popularTimesHistogram', {})
|
49 |
-
df_occupancy = pd.DataFrame()
|
50 |
for day, day_data in occupancy_data.items():
|
51 |
if day_data:
|
52 |
hours = [entry['hour'] for entry in day_data]
|
53 |
occupancy = [entry['occupancyPercent'] for entry in day_data]
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
st.
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
-
# Display reviews data
|
64 |
-
st.subheader("Reviews Data")
|
65 |
-
st.write(f"Total Reviews Count: {reviews_data['reviewsCount']}")
|
66 |
-
df_reviews = pd.DataFrame(list(reviews_data['reviewsDistribution'].items()), columns=['Review', 'Count'])
|
67 |
-
st.bar_chart(df_reviews.set_index('Review'))
|
68 |
else:
|
69 |
st.write("No results found for this website / company name on Google Maps.")
|
|
|
1 |
import streamlit as st
|
2 |
import pandas as pd
|
3 |
+
import numpy as np
|
4 |
from apify_client import ApifyClient
|
5 |
import requests
|
6 |
|
|
|
43 |
st.write(f"**Location:** {lat}, {lng}")
|
44 |
st.write(f"**Temperature:** {temp_in_celsius:.2f}°C")
|
45 |
st.write(f"**Weather:** {current_weather.get('weather')[0].get('description')}")
|
46 |
+
|
47 |
+
# Occupancy Data
|
48 |
st.subheader("Occupancy Data")
|
49 |
occupancy_data = google_maps_data.get('popularTimesHistogram', {})
|
|
|
50 |
for day, day_data in occupancy_data.items():
|
51 |
if day_data:
|
52 |
hours = [entry['hour'] for entry in day_data]
|
53 |
occupancy = [entry['occupancyPercent'] for entry in day_data]
|
54 |
+
st.bar_chart(pd.Series(occupancy, index=hours), use_container_width=True, title=day)
|
55 |
+
|
56 |
+
# Review Count and Distribution
|
57 |
+
st.subheader("Review Count and Distribution")
|
58 |
+
st.write(f"Total Reviews Count: {google_maps_data['reviewsCount']}")
|
59 |
+
review_distribution = google_maps_data['reviewsDistribution']
|
60 |
+
st.bar_chart(pd.Series(review_distribution), use_container_width=True)
|
61 |
+
|
62 |
+
# Reviews Table
|
63 |
+
st.subheader("Customer Reviews")
|
64 |
+
reviews = google_maps_data.get('reviews', [])
|
65 |
+
review_df = pd.DataFrame(reviews)
|
66 |
+
st.table(review_df[['name', 'text', 'publishAt', 'likesCount', 'stars']])
|
67 |
|
|
|
|
|
|
|
|
|
|
|
68 |
else:
|
69 |
st.write("No results found for this website / company name on Google Maps.")
|