Spaces:
Runtime error
Runtime error
Commit
·
bbbf293
1
Parent(s):
6d4d03f
quick fix
Browse files
app.py
CHANGED
|
@@ -37,19 +37,23 @@ st.markdown("""
|
|
| 37 |
✉️ [email protected] المتطوعين ليبغاو يعاونوا يقدرو يتصلوا معنا عبر البريد
|
| 38 |
""")
|
| 39 |
|
| 40 |
-
def parse_latlng_from_link(url):
|
| 41 |
-
# extract latitude and longitude from gmaps link
|
| 42 |
-
session = requests.Session()
|
| 43 |
-
if "@" not in url:
|
| 44 |
-
# We first need to get the redirect URL
|
| 45 |
-
resp = session.head(url, allow_redirects=True)
|
| 46 |
-
url = resp.url
|
| 47 |
-
latlng = url.split('@')[1].split(',')[0:2]
|
| 48 |
-
return [float(latlng[0]), float(latlng[1])]
|
| 49 |
|
| 50 |
|
| 51 |
def parse_gg_sheet_interventions(url):
|
| 52 |
df = pd.read_csv(url)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
return df.assign(latlng=df.iloc[:, 3].apply(parse_latlng_from_link))
|
| 54 |
|
| 55 |
def parse_gg_sheet(url):
|
|
@@ -58,10 +62,11 @@ def parse_gg_sheet(url):
|
|
| 58 |
|
| 59 |
# parse latlng (column 4) to [lat, lng]
|
| 60 |
def parse_latlng(latlng):
|
| 61 |
-
|
| 62 |
lat, lng = latlng.split(",")
|
| 63 |
return [float(lat), float(lng)]
|
| 64 |
-
|
|
|
|
| 65 |
return None
|
| 66 |
|
| 67 |
return df.assign(latlng=df.iloc[:, 4].apply(parse_latlng))
|
|
@@ -161,6 +166,7 @@ for index, row in filtered_df.iterrows():
|
|
| 161 |
st_data = st_folium(m, use_container_width=True)
|
| 162 |
|
| 163 |
# Google Sheet Table
|
|
|
|
| 164 |
st.markdown(
|
| 165 |
"""
|
| 166 |
<iframe src="https://docs.google.com/spreadsheets/d/1gYoBBiBo1L18IVakHkf3t1fOGvHWb23loadyFZUeHJs/" width="100%" height="600px"></iframe>
|
|
@@ -168,6 +174,15 @@ st.markdown(
|
|
| 168 |
unsafe_allow_html=True,
|
| 169 |
)
|
| 170 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
# Google Form
|
| 172 |
# st.markdown(
|
| 173 |
# """
|
|
|
|
| 37 |
✉️ [email protected] المتطوعين ليبغاو يعاونوا يقدرو يتصلوا معنا عبر البريد
|
| 38 |
""")
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
|
| 42 |
def parse_gg_sheet_interventions(url):
|
| 43 |
df = pd.read_csv(url)
|
| 44 |
+
def parse_latlng_from_link(url):
|
| 45 |
+
try:
|
| 46 |
+
# extract latitude and longitude from gmaps link
|
| 47 |
+
session = requests.Session()
|
| 48 |
+
if "@" not in url:
|
| 49 |
+
# We first need to get the redirect URL
|
| 50 |
+
resp = session.head(url, allow_redirects=True)
|
| 51 |
+
url = resp.url
|
| 52 |
+
latlng = url.split('@')[1].split(',')[0:2]
|
| 53 |
+
return [float(latlng[0]), float(latlng[1])]
|
| 54 |
+
except Exception as e:
|
| 55 |
+
print(f"Error parsing latlng from link: {e}")
|
| 56 |
+
return None
|
| 57 |
return df.assign(latlng=df.iloc[:, 3].apply(parse_latlng_from_link))
|
| 58 |
|
| 59 |
def parse_gg_sheet(url):
|
|
|
|
| 62 |
|
| 63 |
# parse latlng (column 4) to [lat, lng]
|
| 64 |
def parse_latlng(latlng):
|
| 65 |
+
try:
|
| 66 |
lat, lng = latlng.split(",")
|
| 67 |
return [float(lat), float(lng)]
|
| 68 |
+
except Exception as e:
|
| 69 |
+
print(f"Error parsing latlng: {e}")
|
| 70 |
return None
|
| 71 |
|
| 72 |
return df.assign(latlng=df.iloc[:, 4].apply(parse_latlng))
|
|
|
|
| 166 |
st_data = st_folium(m, use_container_width=True)
|
| 167 |
|
| 168 |
# Google Sheet Table
|
| 169 |
+
st.subheader("📝 **Table of requests / جدول الطلبات**")
|
| 170 |
st.markdown(
|
| 171 |
"""
|
| 172 |
<iframe src="https://docs.google.com/spreadsheets/d/1gYoBBiBo1L18IVakHkf3t1fOGvHWb23loadyFZUeHJs/" width="100%" height="600px"></iframe>
|
|
|
|
| 174 |
unsafe_allow_html=True,
|
| 175 |
)
|
| 176 |
|
| 177 |
+
# Google Sheet Table
|
| 178 |
+
st.subheader("📝 **Table of interventions / جدول التدخلات**")
|
| 179 |
+
st.markdown(
|
| 180 |
+
"""
|
| 181 |
+
<iframe src="https://docs.google.com/spreadsheets/d/1eXOTqunOWWP8FRdENPs4cU9ulISm4XZWYJJNR1-SrwY/" width="100%" height="600px"></iframe>
|
| 182 |
+
""",
|
| 183 |
+
unsafe_allow_html=True,
|
| 184 |
+
)
|
| 185 |
+
|
| 186 |
# Google Form
|
| 187 |
# st.markdown(
|
| 188 |
# """
|