-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
816 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
|
||
|
||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
Binary file not shown.