Spaces:
Runtime error
Runtime error
Fix: premature operations
Browse files
app.py
CHANGED
@@ -63,19 +63,8 @@ try:
|
|
63 |
page_text_stack.append(page_text)
|
64 |
|
65 |
return page_text_stack
|
66 |
-
with st.spinner('Extracting text from PDF...'):
|
67 |
-
pdf_input = extract_text(uploaded_pdf)
|
68 |
-
st.success('Text extracted')
|
69 |
-
|
70 |
-
pdf_output = []
|
71 |
|
72 |
-
for stack in pdf_input:
|
73 |
-
summarize_text(stack)
|
74 |
-
pdf_output.append(stack)
|
75 |
|
76 |
-
with st.spinner('Summarizing extracted text...'):
|
77 |
-
pdf_summary = '\n\n'.join(pdf_output)
|
78 |
-
st.success('Summary complete')
|
79 |
|
80 |
except: # Handle blank file error
|
81 |
st.error('Please select a valid file')
|
@@ -87,7 +76,20 @@ except: # Handle blank file error
|
|
87 |
|
88 |
|
89 |
|
90 |
-
if st.button('Summarize pdf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
st.markdown(f'''
|
92 |
<div style="background-color: black; color: white; font-weight: bold; padding: 1rem; border-radius: 10px;">
|
93 |
<h4>Download the summary here </h4>
|
|
|
63 |
page_text_stack.append(page_text)
|
64 |
|
65 |
return page_text_stack
|
|
|
|
|
|
|
|
|
|
|
66 |
|
|
|
|
|
|
|
67 |
|
|
|
|
|
|
|
68 |
|
69 |
except: # Handle blank file error
|
70 |
st.error('Please select a valid file')
|
|
|
76 |
|
77 |
|
78 |
|
79 |
+
if st.button('Summarize pdf content'):
|
80 |
+
with st.spinner('Extracting text from PDF...'):
|
81 |
+
pdf_input = extract_text(uploaded_pdf)
|
82 |
+
st.success('Text extracted')
|
83 |
+
|
84 |
+
pdf_output = []
|
85 |
+
|
86 |
+
for stack in pdf_input:
|
87 |
+
summarize_text(stack)
|
88 |
+
pdf_output.append(stack)
|
89 |
+
|
90 |
+
with st.spinner('Summarizing extracted text...'):
|
91 |
+
pdf_summary = '\n\n'.join(pdf_output)
|
92 |
+
st.success('Summary complete')
|
93 |
st.markdown(f'''
|
94 |
<div style="background-color: black; color: white; font-weight: bold; padding: 1rem; border-radius: 10px;">
|
95 |
<h4>Download the summary here </h4>
|