Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pandas as pd
|
| 2 |
+
from pandasai import SmartDataframe
|
| 3 |
+
from langchain_groq.chat_models import ChatGroq
|
| 4 |
+
from langchain_community.llms import Ollama
|
| 5 |
+
import sqlite3
|
| 6 |
+
import os
|
| 7 |
+
|
| 8 |
+
llm = ChatGroq(model_name="llama3-70b-8192", api_key = os.environ["GROQ_API_KEY"])
|
| 9 |
+
|
| 10 |
+
df = pd.read_excel('data.xlsx')
|
| 11 |
+
df = SmartDataframe(df, config={"llm": llm})
|
| 12 |
+
|
| 13 |
+
print( df.chat('Which are the 5 happiest countries?'))
|
| 14 |
+
print( df.chat('What is the sum of the GDPs of the 2 happiest countries?'))
|