-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathapp.py
More file actions
23 lines (19 loc) · 675 Bytes
/
app.py
File metadata and controls
23 lines (19 loc) · 675 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from pandasai.llm.local_llm import LocalLLM
import streamlit as st
import pandas as pd
from pandasai import SmartDataframe
model = LocalLLM(
api_base="http://localhost:11434/v1",
model="llama3"
)
st.title("Data analysis with PandasAI")
uploaded_file= st.file_uploader("Upload a file",type=['csv'])
if uploaded_file is not None:
data = pd.read_csv(uploaded_file)
st.write(data.head(5))
df=SmartDataframe(data,config={"llm":model})
prompt = st.text_area("Enter your prompt: ")
if st.button("Generate"):
if prompt:
with st.spinner("Generating response..."):
st.write(df.chat(prompt))