Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +16 -15
src/streamlit_app.py
CHANGED
|
@@ -17,7 +17,7 @@ st.set_page_config(
|
|
| 17 |
def load_model():
|
| 18 |
return pipeline(
|
| 19 |
"summarization",
|
| 20 |
-
model="Falconsai/text_summarization",
|
| 21 |
device=-1 # CPU only
|
| 22 |
)
|
| 23 |
|
|
@@ -49,28 +49,29 @@ def main():
|
|
| 49 |
|
| 50 |
if uploaded_file and uploaded_file.size <= 5_000_000:
|
| 51 |
if st.button("Generate Summary"):
|
| 52 |
-
with st.spinner("
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
with tab2:
|
| 64 |
st.header("Ask a Question")
|
| 65 |
st.write("Feature coming soon!")
|
| 66 |
-
question = st.text_input("What would you like to ask?")
|
| 67 |
-
if question:
|
| 68 |
-
st.info("Question answering will be available in the next update")
|
| 69 |
|
| 70 |
with tab3:
|
| 71 |
st.header("Share Feedback")
|
| 72 |
feedback = st.text_area("Your thoughts about PrepPal")
|
| 73 |
-
if st.button("Submit"):
|
| 74 |
st.success("Thank you for your feedback!")
|
| 75 |
|
| 76 |
if __name__ == "__main__":
|
|
|
|
| 17 |
def load_model():
|
| 18 |
return pipeline(
|
| 19 |
"summarization",
|
| 20 |
+
model="Falconsai/text_summarization",
|
| 21 |
device=-1 # CPU only
|
| 22 |
)
|
| 23 |
|
|
|
|
| 49 |
|
| 50 |
if uploaded_file and uploaded_file.size <= 5_000_000:
|
| 51 |
if st.button("Generate Summary"):
|
| 52 |
+
with st.spinner("Extracting text..."):
|
| 53 |
+
text = get_pdf_text(uploaded_file)
|
| 54 |
+
|
| 55 |
+
if text: # Only proceed if text extraction succeeded
|
| 56 |
+
with st.spinner("Loading AI model..."):
|
| 57 |
+
model = load_model()
|
| 58 |
+
|
| 59 |
+
with st.spinner("Generating summary..."):
|
| 60 |
+
summary = create_summary(text, model)
|
| 61 |
+
|
| 62 |
+
st.subheader("Summary")
|
| 63 |
+
st.write(summary)
|
| 64 |
+
else:
|
| 65 |
+
st.info("Could not extract text from PDF")
|
| 66 |
|
| 67 |
with tab2:
|
| 68 |
st.header("Ask a Question")
|
| 69 |
st.write("Feature coming soon!")
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
with tab3:
|
| 72 |
st.header("Share Feedback")
|
| 73 |
feedback = st.text_area("Your thoughts about PrepPal")
|
| 74 |
+
if st.button("Submit Feedback"):
|
| 75 |
st.success("Thank you for your feedback!")
|
| 76 |
|
| 77 |
if __name__ == "__main__":
|