Skip to content

Commit

Permalink
tutorial94
Browse files Browse the repository at this point in the history
  • Loading branch information
ronidas39 committed Jun 25, 2024
1 parent 119e67b commit 6068f3e
Show file tree
Hide file tree
Showing 8 changed files with 816 additions and 0 deletions.
Binary file added tutorial94/cache/cache_db_0.10.db
Binary file not shown.
Binary file added tutorial94/cache/cache_db_0.10.db.wal
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions tutorial94/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import streamlit as st
import pandas as pd
from pandasai import SmartDataframe
from langchain_openai import ChatOpenAI
from pandasai.responses.streamlit_response import StreamlitResponse
import os,glob
pwd=os.getcwd()

llm=ChatOpenAI(model="gpt-4o")
st.title("CHAT WITH YOUR EXCEL FILE")
file=st.file_uploader("upload your file",type=["xlsx"])
if file:
df=pd.read_excel(file)
sdf=SmartDataframe(df,
config={"llm":llm,"response_parser":StreamlitResponse,"save_charts":True,
"save_charts_path":pwd
}
)
options=["chat","plot"]
selected_option=st.selectbox("choose an option",options)
if (selected_option=="chat"):
input=st.text_area("ask your question here")
if input is not None:
btn=st.button("submit")
if btn:
response=sdf.chat(input)
st.write(response)
if (selected_option=="plot"):
file=glob.glob(pwd+"/*.png")
if file:
os.remove(file[0])
input=st.text_area("ask your question here")
if input is not None:
btn=st.button("submit")
if btn:
response=sdf.chat(input)
file=glob.glob(pwd+"/*.png")
if file:
st.image(image=file[0],caption="plot for :"+ input,width=1024)




768 changes: 768 additions & 0 deletions tutorial94/pandasai.log

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions tutorial94/question.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
which player has the maximum value?
which player has the maximum wage ?
which club has the maximum player playimng for them? write all the playhers name in simple text
Plot bar chart for top 5 clubs with player count in ascending order , using different colors for each bar
plot pie chart for top 5 clubs with respect to player count
Binary file added tutorial94/trending_football_players.xlsx
Binary file not shown.
Binary file added tutorial94/tutorial94.pptx
Binary file not shown.

0 comments on commit 6068f3e

Please sign in to comment.