Spaces:
Runtime error
Runtime error
Download app.py from NagarajanB1990/First_agent_template: direct link, hf CLI and curl.
- Browser
- Download file 664 Bytes
-
https://huggingface.co/spaces/NagarajanB1990/First_agent_template/resolve/main/app.py
- Command line
-
hf download hf://spaces/NagarajanB1990/First_agent_template/app.py
-
curl -L -o app.py https://huggingface.co/spaces/NagarajanB1990/First_agent_template/resolve/main/app.py
664 Bytes
| import smolagents | |
| print("Smolagents version:", smolagents.__version__) | |
| import gradio as gr | |
| from smolagents import CodeAgent | |
| from smolagents.tools import CalculatorTool | |
| agent = CodeAgent( | |
| tools=[CalculatorTool()], | |
| model="huggingface-projects/zephyr-7b-alpha" # or HuggingFaceH4/zephyr-7b-alpha | |
| ) | |
| def ask_bot(question): | |
| result = agent.run(question) | |
| return result.strip() | |
| iface = gr.Interface( | |
| fn=ask_bot, | |
| inputs=gr.Textbox(label="Ask a math question"), | |
| outputs=gr.Textbox(label="Bot Answer"), | |
| title="Math Bot", | |
| description="Ask math questions — works offline on CPU Space." | |
| ) | |
| if __name__ == "__main__": | |
| iface.launch() | |