Spaces:
Build error
Build error
fix: fix doc paths
Browse files
app.py
CHANGED
@@ -231,7 +231,6 @@ def specify_chapters():
|
|
231 |
st.button(
|
232 |
"Save Chapters", on_click=lambda: st.session_state.update({"chapters": True})
|
233 |
)
|
234 |
-
return title
|
235 |
|
236 |
|
237 |
def upload_and_extract_files():
|
@@ -370,64 +369,59 @@ def display_download_buttons(rep):
|
|
370 |
summaries_docx_path = (
|
371 |
Paths.SUMMARY / f"Overview_of_Public_Submissions-{rep}.docx"
|
372 |
)
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
with
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
with
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
)
|
398 |
-
else:
|
399 |
-
st.warning("DOCX version not available")
|
400 |
-
st.markdown("---")
|
401 |
|
402 |
# Create a container for the Representation Summaries
|
403 |
with st.expander("**Representation Summaries**"):
|
404 |
report_pdf_path = Paths.SUMMARY / f"Summaries_of_Public_Submissions-{rep}.pdf"
|
405 |
report_docx_path = Paths.SUMMARY / f"Summaries_of_Public_Submissions-{rep}.docx"
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
with
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
with
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
st.markdown("---")
|
431 |
|
432 |
|
433 |
def reset_session():
|
@@ -466,9 +460,8 @@ def main():
|
|
466 |
authenticator.logout() # show logout button
|
467 |
|
468 |
# Step 1: Specify chapters
|
469 |
-
rep = ""
|
470 |
if not st.session_state["chapters"]:
|
471 |
-
|
472 |
|
473 |
# Step 2: Upload and extract files
|
474 |
if not st.session_state["files_extracted"] and st.session_state["chapters"]:
|
@@ -479,6 +472,8 @@ def main():
|
|
479 |
build_report()
|
480 |
|
481 |
# Step 4: Show download buttons when complete
|
|
|
|
|
482 |
if st.session_state["completed"]:
|
483 |
display_download_buttons(rep)
|
484 |
|
|
|
231 |
st.button(
|
232 |
"Save Chapters", on_click=lambda: st.session_state.update({"chapters": True})
|
233 |
)
|
|
|
234 |
|
235 |
|
236 |
def upload_and_extract_files():
|
|
|
369 |
summaries_docx_path = (
|
370 |
Paths.SUMMARY / f"Overview_of_Public_Submissions-{rep}.docx"
|
371 |
)
|
372 |
+
with st.container():
|
373 |
+
st.subheader(f"Executive Report for {rep}")
|
374 |
+
col1, col2 = st.columns(2)
|
375 |
+
with col1:
|
376 |
+
with open(summaries_pdf_path, "rb") as pdf_file:
|
377 |
+
st.download_button(
|
378 |
+
label="Download PDF Version",
|
379 |
+
data=pdf_file,
|
380 |
+
file_name=f"Overview_of_Public_Submissions-{rep}.pdf",
|
381 |
+
mime="application/pdf",
|
382 |
+
use_container_width=True,
|
383 |
+
key=f"exec_pdf_{hash(rep)}",
|
384 |
+
)
|
385 |
+
with col2:
|
386 |
+
with open(summaries_docx_path, "rb") as docx_file:
|
387 |
+
st.download_button(
|
388 |
+
label="Download DOCX Version",
|
389 |
+
data=docx_file,
|
390 |
+
file_name=f"Overview_of_Public_Submissions-{rep}.docx",
|
391 |
+
mime="application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
392 |
+
use_container_width=True,
|
393 |
+
key=f"exec_docx_{hash(rep)}",
|
394 |
+
)
|
395 |
+
st.markdown("---")
|
|
|
|
|
|
|
|
|
396 |
|
397 |
# Create a container for the Representation Summaries
|
398 |
with st.expander("**Representation Summaries**"):
|
399 |
report_pdf_path = Paths.SUMMARY / f"Summaries_of_Public_Submissions-{rep}.pdf"
|
400 |
report_docx_path = Paths.SUMMARY / f"Summaries_of_Public_Submissions-{rep}.docx"
|
401 |
+
with st.container():
|
402 |
+
st.subheader(f"Representation Summary for {rep}")
|
403 |
+
col1, col2 = st.columns(2)
|
404 |
+
with col1:
|
405 |
+
with open(report_pdf_path, "rb") as pdf_file:
|
406 |
+
st.download_button(
|
407 |
+
label="Download PDF Version",
|
408 |
+
data=pdf_file,
|
409 |
+
file_name=f"Summaries_of_Public_Submissions-{rep}.pdf",
|
410 |
+
mime="application/pdf",
|
411 |
+
use_container_width=True,
|
412 |
+
key=f"rep_pdf_{hash(rep)}",
|
413 |
+
)
|
414 |
+
with col2:
|
415 |
+
with open(report_docx_path, "rb") as docx_file:
|
416 |
+
st.download_button(
|
417 |
+
label="Download DOCX Version",
|
418 |
+
data=docx_file,
|
419 |
+
file_name=f"Summaries_of_Public_Submissions-{rep}.docx",
|
420 |
+
mime="application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
421 |
+
use_container_width=True,
|
422 |
+
key=f"rep_docx_{hash(rep)}",
|
423 |
+
)
|
424 |
+
st.markdown("---")
|
|
|
425 |
|
426 |
|
427 |
def reset_session():
|
|
|
460 |
authenticator.logout() # show logout button
|
461 |
|
462 |
# Step 1: Specify chapters
|
|
|
463 |
if not st.session_state["chapters"]:
|
464 |
+
specify_chapters()
|
465 |
|
466 |
# Step 2: Upload and extract files
|
467 |
if not st.session_state["files_extracted"] and st.session_state["chapters"]:
|
|
|
472 |
build_report()
|
473 |
|
474 |
# Step 4: Show download buttons when complete
|
475 |
+
with open(Paths.RAW / "title.txt", "r") as f:
|
476 |
+
rep = f.read().strip()
|
477 |
if st.session_state["completed"]:
|
478 |
display_download_buttons(rep)
|
479 |
|