sxd3125 commited on
Commit
4d33070
1 Parent(s): 1985f8e

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +27 -0
README.md ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Import basis libraries
2
+ import pandas as pd
3
+ import pandasai as pdai
4
+ from pandasai import PandasAI
5
+
6
+ from pandasai.llm.starcoder import Starcoder
7
+ # Define List of Models
8
+
9
+ models = {"Starcoder": Starcoder}
10
+
11
+ #@title Select Model to Run
12
+ model_to_run = 'Starcoder' #@param [ "Starcoder", "Open-Assistant"]
13
+ #print(f"Enter API for {model_to_run} platform")
14
+
15
+ # Enter API Key
16
+ API_KEY = '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'#@param {type:"string"}
17
+ pd.DataFrame({
18
+ "country": ["United States", "United Kingdom", "France", "Germany", "Italy", "Spain", "Canada", "Australia", "Japan", "China"],
19
+ "gdp": [21400000, 2940000, 2830000, 3870000, 2160000, 1350000, 1780000, 1320000, 516000, 14000000],
20
+ "happiness_index": [7.3, 7.2, 6.5, 7.0, 6.0, 6.3, 7.3, 7.3, 5.9, 5.0]
21
+ # Model Initialisation
22
+ llm = models[model_to_run](api_token=API_KEY)
23
+ pandas_ai = PandasAI(llm, conversational=False, verbose=True)
24
+ # Enter Prompt related to data or Select from Pre-defined for demo purposes.
25
+ prompt = 'Plot the histogram of countries showing for each the gpd, 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}
26
+ response = pandas_ai.run(df, prompt=prompt,
27
+ is_conversational_answer=False)