Download app.py from piow/web_agent: direct link, hf CLI and curl.
- Browser
- Download file 930 Bytes
-
https://huggingface.co/spaces/piow/web_agent/resolve/main/app.py
- Command line
-
hf download hf://spaces/piow/web_agent/app.py
-
curl -L -o app.py https://huggingface.co/spaces/piow/web_agent/resolve/main/app.py
930 Bytes
| 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.") |