Spaces:
Running
Running
File size: 797 Bytes
5873c3b 22c9788 5873c3b 70a70ec 5873c3b 4878657 5873c3b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
import streamlit as st
from utils import query_agent
# Basic UI
st.title("CSV_067 App | CSV files analysis")
st.header("Please upload your CSV file here:")
# Input OpenAI API key
openai_api_key = st.text_input("Enter your OpenAI API Key:", type="password")
# Capture the CSV file
data = st.file_uploader("Upload CSV file",type="csv")
query = st.text_area("Enter your query")
# Check if OpenAI API key is available
if openai_api_key:
# If OpenAI API key is available, show submit button
button = st.button("Submit")
if button:
try:
# Get Response
answer = query_agent(data, query, openai_api_key=openai_api_key)
st.write(answer)
except Exception as e:
st.error(e)
else:
st.warning("Please input OpenAI API key.")
|