prevent rerun
Browse files- apps/fnb_parser.py +17 -11
apps/fnb_parser.py
CHANGED
@@ -13,6 +13,7 @@ import pandas as pd
|
|
13 |
import plotly.express as px
|
14 |
import streamlit as st
|
15 |
from docx import Document
|
|
|
16 |
|
17 |
###############################################################################
|
18 |
# --------------------------- Core extract logic -------------------------- #
|
@@ -275,6 +276,22 @@ def main() -> None:
|
|
275 |
)
|
276 |
st.dataframe(df, use_container_width=True)
|
277 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
278 |
# Interactive map of extracted coordinates using Plotly
|
279 |
if {"Y_decimal", "X_decimal"}.issubset(df.columns):
|
280 |
geo_df = (
|
@@ -308,17 +325,6 @@ def main() -> None:
|
|
308 |
)
|
309 |
st.plotly_chart(fig, use_container_width=True)
|
310 |
|
311 |
-
# Offer download as Excel
|
312 |
-
buffer = io.BytesIO()
|
313 |
-
with pd.ExcelWriter(buffer, engine="xlsxwriter") as writer:
|
314 |
-
df.to_excel(writer, index=False, sheet_name="Extract")
|
315 |
-
st.download_button(
|
316 |
-
label="💾 Download Excel",
|
317 |
-
data=buffer.getvalue(),
|
318 |
-
file_name="extracted_fnb.xlsx",
|
319 |
-
mime="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
320 |
-
)
|
321 |
-
|
322 |
|
323 |
if __name__ == "__main__": # pragma: no cover
|
324 |
main()
|
|
|
13 |
import plotly.express as px
|
14 |
import streamlit as st
|
15 |
from docx import Document
|
16 |
+
from streamlit.commands.execution_control import rerun
|
17 |
|
18 |
###############################################################################
|
19 |
# --------------------------- Core extract logic -------------------------- #
|
|
|
276 |
)
|
277 |
st.dataframe(df, use_container_width=True)
|
278 |
|
279 |
+
st.markdown("---")
|
280 |
+
# Offer download as Excel
|
281 |
+
buffer = io.BytesIO()
|
282 |
+
with pd.ExcelWriter(buffer, engine="xlsxwriter") as writer:
|
283 |
+
df.to_excel(writer, index=False, sheet_name="Extract")
|
284 |
+
st.download_button(
|
285 |
+
label="💾 Download Excel",
|
286 |
+
data=buffer.getvalue(),
|
287 |
+
file_name="extracted_fnb.xlsx",
|
288 |
+
mime="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
289 |
+
on_click="ignore",
|
290 |
+
type="primary",
|
291 |
+
)
|
292 |
+
|
293 |
+
st.markdown("---")
|
294 |
+
|
295 |
# Interactive map of extracted coordinates using Plotly
|
296 |
if {"Y_decimal", "X_decimal"}.issubset(df.columns):
|
297 |
geo_df = (
|
|
|
325 |
)
|
326 |
st.plotly_chart(fig, use_container_width=True)
|
327 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
328 |
|
329 |
if __name__ == "__main__": # pragma: no cover
|
330 |
main()
|