|
import streamlit as st |
|
|
|
def display_ui(): |
|
st.sidebar.image("/home/oem/Downloads/insightly_wbg.png", use_column_width=True) |
|
st.header("Data Analysis π") |
|
|
|
csv_files = st.file_uploader("Upload CSV files", type="csv", accept_multiple_files=True) |
|
if csv_files: |
|
llm = OpenAI(temperature=0) |
|
user_input = st.text_input("Question here:") |
|
|
|
|
|
for csv_file in csv_files: |
|
with NamedTemporaryFile(delete=False) as f: |
|
f.write(csv_file.getvalue()) |
|
f.flush() |
|
df = pd.read_csv(f.name) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if user_input: |
|
|
|
agent = create_csv_agent(llm, f.name, verbose=True) |
|
response = agent.run(user_input) |
|
|
|
st.write(f"CSV File: {csv_file.name}") |
|
st.write("Response:") |
|
st.write(response) |
|
|