Spaces:
Runtime error
Runtime error
File size: 664 Bytes
534d36d 74a8e18 5c17fd1 bd23629 87905ae 5c17fd1 87905ae 4fb0dcc 58f66f4 cbbfdf7 1eaee38 4fb0dcc 5c17fd1 4fb0dcc 5c17fd1 1eaee38 87905ae 58f66f4 87905ae |
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 |
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()
|