mohamed1ai commited on
Commit
863e23b
1 Parent(s): f30d209

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -0
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pandasai.llm.local_llm import LocalLLM
2
+ from pandasai import Agent
3
+ import streamlit as st
4
+ import pandas as pd
5
+
6
+ model = LocalLLM(
7
+ api_base='http://0.0.0.0:11434/v1',
8
+ model='llama3'
9
+ )
10
+
11
+ st.title('MBA data analysis with LLAMA3')
12
+
13
+ upload_file = st.sidebar.file_uploader(
14
+ 'upload a csv file',
15
+ type=["csv"]
16
+ )
17
+
18
+ if upload_file is not None:
19
+ data =pd.read_csv(upload_file)
20
+ st.write(data.head(7))
21
+ agent = Agent(data, config={"llm": model})
22
+ prompt = st.text_input('Prompt:')
23
+
24
+ if st.button("Generation"):
25
+ if prompt:
26
+ with st.spinner("Generating rep ...."):
27
+ st.write(agent.chat(prompt))
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+