Spaces:
Sleeping
Sleeping
app.py
CHANGED
@@ -107,3 +107,19 @@ if uploaded_file:
|
|
107 |
st.download_button("📥 Download Report PDF", f, file_name=file_path, mime="application/pdf")
|
108 |
else:
|
109 |
st.warning("Please make sure to run summarization and enter name/note.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
st.download_button("📥 Download Report PDF", f, file_name=file_path, mime="application/pdf")
|
108 |
else:
|
109 |
st.warning("Please make sure to run summarization and enter name/note.")
|
110 |
+
|
111 |
+
st.subheader("💬 Ask Questions About the Report")
|
112 |
+
|
113 |
+
if 'summary' in st.session_state and 'explanation' in st.session_state:
|
114 |
+
user_question = st.text_input("Ask a question based on the report:")
|
115 |
+
|
116 |
+
if st.button("Get Answer") and user_question:
|
117 |
+
with st.spinner("Thinking..."):
|
118 |
+
context = st.session_state['summary'] + "\n" + st.session_state['explanation']
|
119 |
+
prompt = f"Context: {context}\n\nQuestion: {user_question}\n\nAnswer in simple words:"
|
120 |
+
response = explainer(prompt)[0]['generated_text']
|
121 |
+
st.success("✅ AI Response:")
|
122 |
+
st.write(response)
|
123 |
+
else:
|
124 |
+
st.info("Upload a report and run summarization to use the chatbot.")
|
125 |
+
|