Spaces:
Build error

File size: 930 Bytes
a2c13f6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
from web_agent import agent  # Import the agent instance from web_agent.py

# Title of the app
st.title("AI Agent Chat Interface")

# Sidebar for user input
st.sidebar.header("Input Parameters")
user_input = st.sidebar.text_area("Enter your query:", "")

# Main section
st.header("Agent Response")

if st.button("Submit"):
    if user_input.strip():
        try:
            # Query the agent with the user input
            response = agent.run(user_input)  # Use the `run` method to process the query
            
            # Extract the content from the RunResponse object
            if hasattr(response, "content"):
                st.success(response.content)
            else:
                st.error("Unexpected response format from the agent.")
        except Exception as e:
            st.error(f"An error occurred: {e}")
    else:
        st.warning("Please enter a query before submitting.")