Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -21,8 +21,14 @@ if not st.session_state.initialized:
|
|
21 |
cols = ["Latitude", "Longitude", "dumpster_created", "voting", "comment", "voting_created", "name"]
|
22 |
|
23 |
dumpsters_df = pd.DataFrame(columns=cols)
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
for dumpster in tqdm(dumpsters):
|
25 |
-
|
26 |
url = f"https://dumpstermap.herokuapp.com/dumpsters/{dumpster['id']}"
|
27 |
response = requests.get(url)
|
28 |
if response.status_code != 200:
|
@@ -48,7 +54,7 @@ if not st.session_state.initialized:
|
|
48 |
|
49 |
if rows:
|
50 |
dumpsters_df = pd.concat([dumpsters_df, pd.DataFrame(rows)], ignore_index=True)
|
51 |
-
|
52 |
except Exception as e:
|
53 |
print(e)
|
54 |
|
|
|
21 |
cols = ["Latitude", "Longitude", "dumpster_created", "voting", "comment", "voting_created", "name"]
|
22 |
|
23 |
dumpsters_df = pd.DataFrame(columns=cols)
|
24 |
+
my_bar = st.progress(0, text="% of spots fetched")
|
25 |
+
|
26 |
+
num_dumpsters = len(dumpsters)
|
27 |
+
|
28 |
+
count = 0
|
29 |
+
|
30 |
for dumpster in tqdm(dumpsters):
|
31 |
+
my_bar.progress(int(count/num_dumpsters))
|
32 |
url = f"https://dumpstermap.herokuapp.com/dumpsters/{dumpster['id']}"
|
33 |
response = requests.get(url)
|
34 |
if response.status_code != 200:
|
|
|
54 |
|
55 |
if rows:
|
56 |
dumpsters_df = pd.concat([dumpsters_df, pd.DataFrame(rows)], ignore_index=True)
|
57 |
+
count += 1
|
58 |
except Exception as e:
|
59 |
print(e)
|
60 |
|