Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import streamlit as st
|
2 |
-
import pymupdf
|
3 |
import re
|
4 |
import traceback
|
5 |
import faiss
|
@@ -119,7 +119,7 @@ def generate_response(user_query, pdf_ticker, ai_ticker, mode, uploaded_file):
|
|
119 |
return "Error generating response."
|
120 |
|
121 |
st.markdown(
|
122 |
-
"<h1 style='text-align: center; color: #4CAF50;'
|
123 |
unsafe_allow_html=True
|
124 |
)
|
125 |
st.markdown(
|
@@ -149,7 +149,7 @@ else:
|
|
149 |
uploaded_file = None
|
150 |
pdf_ticker = None
|
151 |
|
152 |
-
if st.button("
|
153 |
if mode == "π PDF Upload Mode" and (not uploaded_file or not pdf_ticker):
|
154 |
st.error("β Please upload a PDF and enter a company ticker for insights.")
|
155 |
elif mode == "π Live Data Mode" and not ai_ticker:
|
@@ -159,14 +159,7 @@ if st.button("π Analyze Now"):
|
|
159 |
response = generate_response(user_query, pdf_ticker, ai_ticker, mode, uploaded_file)
|
160 |
st.markdown("---")
|
161 |
st.markdown("<h3 style='color: #4CAF50;'>π‘ AI Response</h3>", unsafe_allow_html=True)
|
162 |
-
|
163 |
-
st.markdown(
|
164 |
-
f"""
|
165 |
-
<div style="border: 1px solid #444; padding: 15px; background-color: #000; border-radius: 10px;">
|
166 |
-
<p style="color: #000; font-size: 16px;">{response}</p>
|
167 |
-
</div>
|
168 |
-
""",
|
169 |
-
unsafe_allow_html=True
|
170 |
-
)
|
171 |
|
172 |
st.markdown("---")
|
|
|
|
1 |
import streamlit as st
|
2 |
+
import pymupdf # Using pymupdf directly
|
3 |
import re
|
4 |
import traceback
|
5 |
import faiss
|
|
|
119 |
return "Error generating response."
|
120 |
|
121 |
st.markdown(
|
122 |
+
"<h1 style='text-align: center; color: #4CAF50;'>π FinQuery RAG Chatbot</h1>",
|
123 |
unsafe_allow_html=True
|
124 |
)
|
125 |
st.markdown(
|
|
|
149 |
uploaded_file = None
|
150 |
pdf_ticker = None
|
151 |
|
152 |
+
if st.button("Analyze Now"):
|
153 |
if mode == "π PDF Upload Mode" and (not uploaded_file or not pdf_ticker):
|
154 |
st.error("β Please upload a PDF and enter a company ticker for insights.")
|
155 |
elif mode == "π Live Data Mode" and not ai_ticker:
|
|
|
159 |
response = generate_response(user_query, pdf_ticker, ai_ticker, mode, uploaded_file)
|
160 |
st.markdown("---")
|
161 |
st.markdown("<h3 style='color: #4CAF50;'>π‘ AI Response</h3>", unsafe_allow_html=True)
|
162 |
+
st.write(response)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
|
164 |
st.markdown("---")
|
165 |
+
|