Falah commited on
Commit
f03f3c4
·
1 Parent(s): c84912e
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -2,7 +2,7 @@ import streamlit as st
2
  import pandas as pd
3
  from langchain.agents import create_csv_agent
4
  from langchain.llms import OpenAI
5
-
6
  # Set Streamlit page configuration
7
  st.set_page_config(page_title='CSV Processing',
8
  page_icon=":memo:",
@@ -74,17 +74,20 @@ if not openai_api_key or not openai_api_key.startswith('sk-'):
74
  else:
75
  if uploaded_file is not None:
76
  # Create a progress bar
77
- progress_bar = st.progress(0)
78
- progress_bar.progress(25) # Start the progress at 25%
79
-
80
  csv_file = load_data(uploaded_file) # Now the uploaded file is an XLS file
81
- progress_bar.progress(50) # Update the progress to 50%
82
 
83
  agent = initialize_agent(csv_file, openai_api_key)
84
- progress_bar.progress(100) # Complete the progress bar
85
 
86
  if question:
87
  response = agent.run(question)
 
 
 
88
  #st.markdown(f'**Response:** {response}')
89
- st.markdown(f'<div style="color: red; font-size: 24px; text-align: center;">**{response}**</div>',unsafe_allow_html=True)
90
 
 
2
  import pandas as pd
3
  from langchain.agents import create_csv_agent
4
  from langchain.llms import OpenAI
5
+ import time
6
  # Set Streamlit page configuration
7
  st.set_page_config(page_title='CSV Processing',
8
  page_icon=":memo:",
 
74
  else:
75
  if uploaded_file is not None:
76
  # Create a progress bar
77
+ #progress_bar = st.progress(0)
78
+ #progress_bar.progress(25) # Start the progress at 25%
79
+
80
  csv_file = load_data(uploaded_file) # Now the uploaded file is an XLS file
81
+ #progress_bar.progress(50) # Update the progress to 50%
82
 
83
  agent = initialize_agent(csv_file, openai_api_key)
84
+ #progress_bar.progress(100) # Complete the progress bar
85
 
86
  if question:
87
  response = agent.run(question)
88
+ with st.spinner('Wait for it...'):
89
+ time.sleep(5)
90
+ st.success('Done!')
91
  #st.markdown(f'**Response:** {response}')
92
+ st.markdown(f'<div style="color: red; font-size: 24px; text-align: center;">The Answer is:{response}</div>',unsafe_allow_html=True)
93