Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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
|
|
|
|
|
|
|
|
|
|
| 44 |
# Read the CSV file
|
| 45 |
-
|
| 46 |
|
| 47 |
# Display the data
|
| 48 |
-
|
| 49 |
-
|
| 50 |
|
| 51 |
# Plot the data
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 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")
|