Spaces:
Runtime error
Runtime error
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() | |