NagarajanB1990's picture
Update app.py
534d36d verified
raw
history blame contribute delete
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()