svsaurav95 commited on
Commit
3be2608
Β·
verified Β·
1 Parent(s): c66a153

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -12
app.py CHANGED
@@ -138,28 +138,30 @@ with col2:
138
  user_query = st.text_input("πŸ’¬ What financial insights are you looking for?")
139
 
140
  st.markdown("---")
 
 
141
  if mode == "πŸ“„ PDF Upload Mode":
142
  st.markdown("### πŸ“‚ Upload Your Financial Report")
143
- uploaded_file = st.file_uploader("πŸ”Ό Upload PDF (Only for PDF Mode)", type=["pdf"])
144
- pdf_ticker = st.text_input("🏒 Enter Company Ticker for PDF Insights", placeholder="e.g., INFY, TCS")
145
- ai_ticker = None
146
  else:
147
  st.markdown("### 🌍 Live Market Data")
148
- ai_ticker = st.text_input("🏒 Enter Company Ticker for AI Insights", placeholder="e.g., AAPL, MSFT")
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:
156
- st.error("❌ Please enter a valid company ticker for AI insights.")
 
157
  else:
158
- with st.spinner("πŸ” Your Query is Processing, this can take up to 5 - 7 minutes ⏳"):
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
 
 
138
  user_query = st.text_input("πŸ’¬ What financial insights are you looking for?")
139
 
140
  st.markdown("---")
141
+ uploaded_file, company_ticker = None, None
142
+
143
  if mode == "πŸ“„ PDF Upload Mode":
144
  st.markdown("### πŸ“‚ Upload Your Financial Report")
145
+ uploaded_file = st.file_uploader("πŸ”Ό Upload PDF Report", type=["pdf"])
146
+
 
147
  else:
148
  st.markdown("### 🌍 Live Market Data")
149
+ company_ticker = st.text_input("🏒 Enter Company Ticker Symbol", placeholder="e.g., AAPL, MSFT")
150
  uploaded_file = None
 
151
 
152
+ # 🎯 Submit Button
153
+ if st.button("πŸš€ Analyze Now"):
154
+ if mode == "πŸ“„ PDF Upload Mode" and not uploaded_file:
155
+ st.error("❌ Please upload a PDF file.")
156
+ elif mode == "🌍 Live Data Mode" and not company_ticker:
157
+ st.error("❌ Please enter a valid company ticker symbol.")
158
  else:
159
+ with st.spinner("πŸ” Your Query is Processing, this can take upto 5 - 7 minutes⏳"):
160
+ response = generate_response(user_query, company_ticker, mode, uploaded_file)
161
  st.markdown("---")
162
  st.markdown("<h3 style='color: #4CAF50;'>πŸ’‘ AI Response</h3>", unsafe_allow_html=True)
163
  st.write(response)
164
 
165
+ # πŸ“Œ Footer
166
  st.markdown("---")
167