Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ from langchain_groq import ChatGroq
|
|
12 |
import torch
|
13 |
import os
|
14 |
|
15 |
-
st.set_page_config(page_title="
|
16 |
|
17 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
18 |
|
@@ -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("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,7 +159,15 @@ 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 |
|
164 |
st.markdown("---")
|
165 |
-
|
|
|
12 |
import torch
|
13 |
import os
|
14 |
|
15 |
+
st.set_page_config(page_title="Financial Insights Chatbot", page_icon="π", layout="wide")
|
16 |
|
17 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
18 |
|
|
|
119 |
return "Error generating response."
|
120 |
|
121 |
st.markdown(
|
122 |
+
"<h1 style='text-align: center; color: #4CAF50;'>π AI-Powered Financial Insights 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 |
+
|
163 |
+
# π AI Response Box with Styling
|
164 |
+
st.markdown(
|
165 |
+
f"""
|
166 |
+
<div style="border: 1px solid #444; padding: 15px; background-color: #f7f7f7; border-radius: 10px;">
|
167 |
+
<p style="color: #222; font-size: 16px;">{response}</p>
|
168 |
+
</div>
|
169 |
+
""",
|
170 |
+
unsafe_allow_html=True
|
171 |
+
)
|
172 |
|
173 |
st.markdown("---")
|
|