sxd3125 commited on
Commit
058b6c6
1 Parent(s): fde343f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -2
app.py CHANGED
@@ -4,8 +4,21 @@ import pandas as pd
4
  from pandasai import PandasAI
5
  import seaborn as sns
6
  import matplotlib.pyplot as plt
 
7
  from pandasai.llm.starcoder import Starcoder
8
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  # Define List of Models
10
 
11
  models = {"Starcoder": Starcoder}
@@ -16,7 +29,7 @@ model_to_run = 'Starcoder' #@param [ "Starcoder", "Open-Assistant"]
16
 
17
  # Enter API Key
18
  API_KEY = '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'#@param {type:"string"}
19
- pd.DataFrame({
20
  "country": ["United States", "United Kingdom", "France", "Germany", "Italy", "Spain", "Canada", "Australia", "Japan", "China"],
21
  "gdp": [21400000, 2940000, 2830000, 3870000, 2160000, 1350000, 1780000, 1320000, 516000, 14000000],
22
  "happiness_index": [7.3, 7.2, 6.5, 7.0, 6.0, 6.3, 7.3, 7.3, 5.9, 5.0]})
@@ -26,4 +39,5 @@ pandas_ai = PandasAI(llm, conversational=False, verbose=True)
26
  # Enter Prompt related to data or Select from Pre-defined for demo purposes.
27
  prompt = 'Plot the histogram of countries showing for each the gdp, using different colors for each bar' #@param [ "What is the relation between GDP and Happines Index", "Plot the histogram of countries showing for each the gpd, using different colors for each bar", "GDP of Top 5 Happiest Countries?"] {allow-input: true}
28
  response = pandas_ai.run(df, prompt=prompt,
29
- is_conversational_answer=False)
 
 
4
  from pandasai import PandasAI
5
  import seaborn as sns
6
  import matplotlib.pyplot as plt
7
+ #from pandasai.llm.starcoder import Starcoder
8
  from pandasai.llm.starcoder import Starcoder
9
 
10
+ API_KEY = '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'#@param {type:"string"}
11
+ df =pd.DataFrame({
12
+ "country": ["United States", "United Kingdom", "France", "Germany", "Italy", "Spain", "Canada", "Australia", "Japan", "China"],
13
+ "gdp": [21400000, 2940000, 2830000, 3870000, 2160000, 1350000, 1780000, 1320000, 516000, 14000000],
14
+ "happiness_index": [7.3, 7.2, 6.5, 7.0, 6.0, 6.3, 7.3, 7.3, 5.9, 5.0]})
15
+
16
+
17
+ llm = Starcoder(api_token=API_KEY)
18
+ pandas_ai = PandasAI(llm)
19
+ response = pandas_ai.run(df, "Your prompt goes here")
20
+
21
+ '''
22
  # Define List of Models
23
 
24
  models = {"Starcoder": Starcoder}
 
29
 
30
  # Enter API Key
31
  API_KEY = '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'#@param {type:"string"}
32
+ df = pd.DataFrame({
33
  "country": ["United States", "United Kingdom", "France", "Germany", "Italy", "Spain", "Canada", "Australia", "Japan", "China"],
34
  "gdp": [21400000, 2940000, 2830000, 3870000, 2160000, 1350000, 1780000, 1320000, 516000, 14000000],
35
  "happiness_index": [7.3, 7.2, 6.5, 7.0, 6.0, 6.3, 7.3, 7.3, 5.9, 5.0]})
 
39
  # Enter Prompt related to data or Select from Pre-defined for demo purposes.
40
  prompt = 'Plot the histogram of countries showing for each the gdp, using different colors for each bar' #@param [ "What is the relation between GDP and Happines Index", "Plot the histogram of countries showing for each the gpd, using different colors for each bar", "GDP of Top 5 Happiest Countries?"] {allow-input: true}
41
  response = pandas_ai.run(df, prompt=prompt,
42
+ is_conversational_answer=False)
43
+ '''