github-sync-test / smolagents /smol_gradio.py
billyaungmyint's picture
Sync from GitHub via hub-sync
2277115 verified
raw
history blame contribute delete
375 Bytes
from smolagents import (
load_tool,
CodeAgent,
InferenceClientModel,
GradioUI
)
# Import tool from Hub
image_generation_tool = load_tool("m-ric/text-to-image", trust_remote_code=True)
model = InferenceClientModel()
# Initialize the agent with the image generation tool
agent = CodeAgent(tools=[image_generation_tool], model=model)
GradioUI(agent).launch()