rairo commited on
Commit
70415ca
·
verified ·
1 Parent(s): 422039c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -8
app.py CHANGED
@@ -4,6 +4,7 @@ import os
4
  import pandas as pd
5
  from pandasai import SmartDataframe
6
  from pandasai.responses.response_parser import ResponseParser
 
7
 
8
  class StreamLitResponse(ResponseParser):
9
  def __init__(self,context) -> None:
@@ -27,9 +28,12 @@ def generateResponse(dataFrame,prompt):
27
  return answer
28
 
29
  st.write("# Brave Retail Insights")
 
30
  st.write("##### Engage in insightful conversations with your data through powerful visualizations")
31
  with st.sidebar:
32
  st.title("Brave Retail Insights")
 
 
33
 
34
  # Added a divider
35
  st.divider()
@@ -40,16 +44,22 @@ with st.sidebar:
40
 
41
  uploaded_file = "bon_marche.csv"
42
  #uploaded_file = "healthcare_dataset.csv"
43
- if uploaded_file is not None:
 
 
 
44
  # Read the CSV file
45
- df = pd.read_csv(uploaded_file)
46
 
47
  # Display the data
48
- with st.expander("Preview"):
49
- st.write(df.head())
50
 
51
  # Plot the data
52
- user_input = st.text_input("Type your message here",placeholder="Ask me about your data")
53
- if user_input:
54
- answer = generateResponse(dataFrame=df,prompt=user_input)
55
- st.write(answer)
 
 
 
 
4
  import pandas as pd
5
  from pandasai import SmartDataframe
6
  from pandasai.responses.response_parser import ResponseParser
7
+ from st_on_hover_tabs import on_hover_tabs
8
 
9
  class StreamLitResponse(ResponseParser):
10
  def __init__(self,context) -> None:
 
28
  return answer
29
 
30
  st.write("# Brave Retail Insights")
31
+ st.markdown('<style>' + open('./style.css').read() + '</style>', unsafe_allow_html=True)
32
  st.write("##### Engage in insightful conversations with your data through powerful visualizations")
33
  with st.sidebar:
34
  st.title("Brave Retail Insights")
35
+ tabs = on_hover_tabs(tabName=['Chat', 'Reports'],
36
+ iconName=['chat', 'dashboard'], default_choice=0)
37
 
38
  # Added a divider
39
  st.divider()
 
44
 
45
  uploaded_file = "bon_marche.csv"
46
  #uploaded_file = "healthcare_dataset.csv"
47
+ if tabs =='chat':
48
+ st.header("Brave Retail Chat")
49
+ st.write("Get visualizations and analysis from our Gemini powered agent")
50
+
51
  # Read the CSV file
52
+ df = pd.read_csv(uploaded_file)
53
 
54
  # Display the data
55
+ with st.expander("Preview"):
56
+ st.write(df.head())
57
 
58
  # Plot the data
59
+ user_input = st.text_input("Type your message here",placeholder="Ask me about your data")
60
+ if user_input:
61
+ answer = generateResponse(dataFrame=df,prompt=user_input)
62
+ st.write(answer)
63
+
64
+ elif tabs == 'Reports':
65
+ st.header("Reports")