Zasha1 commited on
Commit
bcfe461
·
verified ·
1 Parent(s): a916880

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -7
app.py CHANGED
@@ -174,6 +174,17 @@ def real_time_analysis():
174
  for rec in recommendations:
175
  st.write(rec)
176
 
 
 
 
 
 
 
 
 
 
 
 
177
  def run_app():
178
  st.set_page_config(page_title="Sales Call Assistant", layout="wide")
179
  st.title("AI Sales Call Assistant")
@@ -295,11 +306,9 @@ def run_app():
295
  elif app_mode == "Dashboard":
296
  st.markdown('<div class="section">', unsafe_allow_html=True)
297
  st.header("Call Summaries and Sentiment Analysis")
298
- try:
299
- data = fetch_call_data(config["google_sheet_id"])
300
- if data.empty:
301
- st.warning("No data available in the Google Sheet.")
302
- else:
303
  sentiment_counts = data['Sentiment'].value_counts()
304
 
305
  product_mentions = filter_product_mentions(data[['Chunk']].values.tolist(), product_titles)
@@ -359,8 +368,8 @@ def run_app():
359
  st.write("---")
360
  else:
361
  st.error("No details available for the selected Call ID.")
362
- except Exception as e:
363
- st.error(f"Error loading dashboard: {e}")
364
  st.markdown('</div>', unsafe_allow_html=True)
365
 
366
  if __name__ == "__main__":
 
174
  for rec in recommendations:
175
  st.write(rec)
176
 
177
+ def load_google_sheets_data():
178
+ try:
179
+ data = fetch_call_data(config["google_sheet_id"])
180
+ if data.empty:
181
+ st.warning("No data available in the Google Sheet.")
182
+ else:
183
+ return data
184
+ except Exception as e:
185
+ st.error(f"Error loading data from Google Sheets: {e}")
186
+ return None
187
+
188
  def run_app():
189
  st.set_page_config(page_title="Sales Call Assistant", layout="wide")
190
  st.title("AI Sales Call Assistant")
 
306
  elif app_mode == "Dashboard":
307
  st.markdown('<div class="section">', unsafe_allow_html=True)
308
  st.header("Call Summaries and Sentiment Analysis")
309
+ data = load_google_sheets_data()
310
+ if data is not None:
311
+ try:
 
 
312
  sentiment_counts = data['Sentiment'].value_counts()
313
 
314
  product_mentions = filter_product_mentions(data[['Chunk']].values.tolist(), product_titles)
 
368
  st.write("---")
369
  else:
370
  st.error("No details available for the selected Call ID.")
371
+ except Exception as e:
372
+ st.error(f"Error processing data: {e}")
373
  st.markdown('</div>', unsafe_allow_html=True)
374
 
375
  if __name__ == "__main__":