Spaces:
Build error
Build error
Download app.py from smithaneka/agent2: direct link, hf CLI and curl.
- Browser
- Download file 699 Bytes
-
https://huggingface.co/spaces/smithaneka/agent2/resolve/main/app.py
- Command line
-
hf download hf://spaces/smithaneka/agent2/app.py
-
curl -L -o app.py https://huggingface.co/spaces/smithaneka/agent2/resolve/main/app.py
699 Bytes
| import gradio as gr | |
| # A simple agent function | |
| def simple_agent(user_input): | |
| if "hello" in user_input.lower(): | |
| return "Hi there! I'm your AI agent 🤖. How can I help you today?" | |
| elif "help" in user_input.lower(): | |
| return "Sure! I can help you with AI, coding, or general questions." | |
| else: | |
| return "I'm not sure how to respond. Try saying 'hello' or 'help'." | |
| # Build a Gradio interface | |
| iface = gr.Interface( | |
| fn=simple_agent, | |
| inputs="text", | |
| outputs="text", | |
| title="Beginner AI Agent", | |
| description="Type something to interact with a basic AI agent built using Gradio and Python!" | |
| ) | |
| # Launch the app | |
| if __name__ == "__main__": | |
| iface.launch() | |