chmawia commited on
Commit
7196622
Β·
verified Β·
1 Parent(s): a50c297

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -21
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
- # App title
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 st.button("Extract Important Info"):
50
- if uploaded_file is not None:
 
 
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
- if key_points:
63
- st.subheader("πŸ“Œ Key Points")
64
- for point in key_points:
65
- st.write(f"- {point}")
66
-
67
- if mcqs:
68
- st.subheader("❓ MCQs")
69
- for question in mcqs:
70
- st.write(f"- {question}")
71
-
72
- if important_questions:
73
- st.subheader("❓ Important Questions")
74
- for question in important_questions:
75
- st.write(f"- {question}")
76
-
77
- else:
78
- st.warning("⚠️ Please upload a PDF file first.")
 
 
 
 
 
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.")