Spaces:
Sleeping
Sleeping
streamlit app
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from ai_agent import pandas_agent
|
3 |
+
|
4 |
+
# Get user input
|
5 |
+
file = st.file_uploader("Upload CSV file")
|
6 |
+
agent_input = st.text_input("Enter question")
|
7 |
+
|
8 |
+
if st.button('Execute'):
|
9 |
+
if file is not None and agent_input != "":
|
10 |
+
# Create a loading spinner
|
11 |
+
with st.spinner('Running the agent...'):
|
12 |
+
# Call the pandas_agent function
|
13 |
+
output = pandas_agent(file, agent_input)
|
14 |
+
|
15 |
+
# Display the output
|
16 |
+
st.write(output)
|
17 |
+
else:
|
18 |
+
st.write("Please upload a file and enter a question.")
|