rairo commited on
Commit
27c01eb
·
verified ·
1 Parent(s): 85d0f26

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -8
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import streamlit as st
2
  import pandas as pd
3
  import pandasai as PandasAI
4
- from pandasai import SmartDatalake
5
  from pandasai.responses.response_parser import ResponseParser
6
  from pandasai.llm import GoogleGemini
7
  import plotly.express as px
@@ -17,6 +17,7 @@ import os
17
  from markdown_pdf import MarkdownPdf, Section
18
  import tempfile
19
  from langchain_google_genai import ChatGoogleGenerativeAI
 
20
  # Configure Gemini API
21
  gemini_api_key = os.environ.get('GOOGLE_API_KEY')
22
  if not gemini_api_key:
@@ -46,7 +47,7 @@ llm1 = ChatGoogleGenerativeAI(
46
  max_retries=2
47
  )
48
 
49
- pandas_ai = PandasAI(llm=llm1)
50
 
51
  def load_data():
52
  """Load data from CSV files and validate"""
@@ -70,13 +71,18 @@ def load_data():
70
  return None
71
 
72
 
73
- def my_insights(df):
74
- insights = pandas_ai(df)
75
- return insights
76
 
77
- events_i = my_insights(events_df)
78
- customer_i = my_insights(customers_df)
79
- products_i = my_insights(products_df)
 
 
 
 
 
 
 
 
80
  #Dashboard
81
  def create_dashboard(data):
82
  """Create dashboard visualizations"""
 
1
  import streamlit as st
2
  import pandas as pd
3
  import pandasai as PandasAI
4
+ from pandasai import SmartDatalake, SmartDataframe
5
  from pandasai.responses.response_parser import ResponseParser
6
  from pandasai.llm import GoogleGemini
7
  import plotly.express as px
 
17
  from markdown_pdf import MarkdownPdf, Section
18
  import tempfile
19
  from langchain_google_genai import ChatGoogleGenerativeAI
20
+
21
  # Configure Gemini API
22
  gemini_api_key = os.environ.get('GOOGLE_API_KEY')
23
  if not gemini_api_key:
 
47
  max_retries=2
48
  )
49
 
50
+
51
 
52
  def load_data():
53
  """Load data from CSV files and validate"""
 
71
  return None
72
 
73
 
 
 
 
74
 
75
+
76
+ events_i = SmartDataframe(events_df, config={
77
+ "llm": llm1
78
+ })
79
+ customer_i = SmartDataframe(customers_df, config={
80
+ "llm": llm1
81
+
82
+ })
83
+ products_i = SmartDataframe(products_df, config={
84
+ "llm": llm1,
85
+ })
86
  #Dashboard
87
  def create_dashboard(data):
88
  """Create dashboard visualizations"""