Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,26 @@ import re
|
|
| 6 |
# Configure Streamlit page
|
| 7 |
st.set_page_config(page_title="Extract Key Info", layout="centered")
|
| 8 |
|
| 9 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
st.markdown("<h1 style='text-align: center;'>π Extract Key Points & MCQs</h1>", unsafe_allow_html=True)
|
| 11 |
|
| 12 |
# File uploader
|
|
@@ -45,9 +64,11 @@ def extract_relevant_info(pdf_path):
|
|
| 45 |
|
| 46 |
return key_points, mcqs, important_questions
|
| 47 |
|
| 48 |
-
# Extract Data Button
|
| 49 |
-
if
|
| 50 |
-
|
|
|
|
|
|
|
| 51 |
with st.spinner("Processing your PDF..."):
|
| 52 |
temp_path = "temp.pdf"
|
| 53 |
with open(temp_path, "wb") as f:
|
|
@@ -59,20 +80,24 @@ if st.button("Extract Important Info"):
|
|
| 59 |
# Display extracted data
|
| 60 |
st.success("β
Extraction Complete!")
|
| 61 |
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
# Configure Streamlit page
|
| 7 |
st.set_page_config(page_title="Extract Key Info", layout="centered")
|
| 8 |
|
| 9 |
+
# Custom Styling
|
| 10 |
+
st.markdown(
|
| 11 |
+
"""
|
| 12 |
+
<style>
|
| 13 |
+
.stButton button {
|
| 14 |
+
width: 100% !important;
|
| 15 |
+
background-color: #1E90FF;
|
| 16 |
+
color: white;
|
| 17 |
+
font-size: 18px;
|
| 18 |
+
}
|
| 19 |
+
.stFileUploader {
|
| 20 |
+
border: 2px dashed #1E90FF;
|
| 21 |
+
padding: 10px;
|
| 22 |
+
}
|
| 23 |
+
</style>
|
| 24 |
+
""",
|
| 25 |
+
unsafe_allow_html=True,
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
# Page title
|
| 29 |
st.markdown("<h1 style='text-align: center;'>π Extract Key Points & MCQs</h1>", unsafe_allow_html=True)
|
| 30 |
|
| 31 |
# File uploader
|
|
|
|
| 64 |
|
| 65 |
return key_points, mcqs, important_questions
|
| 66 |
|
| 67 |
+
# Extract Data Button (Disabled until file is uploaded)
|
| 68 |
+
if uploaded_file:
|
| 69 |
+
extract_button = st.button("π Extract Important Info", use_container_width=True)
|
| 70 |
+
|
| 71 |
+
if extract_button:
|
| 72 |
with st.spinner("Processing your PDF..."):
|
| 73 |
temp_path = "temp.pdf"
|
| 74 |
with open(temp_path, "wb") as f:
|
|
|
|
| 80 |
# Display extracted data
|
| 81 |
st.success("β
Extraction Complete!")
|
| 82 |
|
| 83 |
+
col1, col2 = st.columns(2)
|
| 84 |
+
|
| 85 |
+
with col1:
|
| 86 |
+
if key_points:
|
| 87 |
+
st.subheader("π Key Points")
|
| 88 |
+
for point in key_points:
|
| 89 |
+
st.write(f"- {point}")
|
| 90 |
+
|
| 91 |
+
with col2:
|
| 92 |
+
if mcqs:
|
| 93 |
+
st.subheader("β MCQs")
|
| 94 |
+
for question in mcqs:
|
| 95 |
+
st.write(f"- {question}")
|
| 96 |
+
|
| 97 |
+
if important_questions:
|
| 98 |
+
st.subheader("β Important Questions")
|
| 99 |
+
for question in important_questions:
|
| 100 |
+
st.write(f"- {question}")
|
| 101 |
+
|
| 102 |
+
else:
|
| 103 |
+
st.warning("β οΈ Please upload a PDF file first.")
|