MeghanaNanuvala's picture
Update app.py
27ed756 verified
raw
history blame contribute delete
807 Bytes
import gradio as gr
from smolagents import CodeAgent, InferenceClientModel
from tools import WeatherInfoTool, HubStatsTool, DDGSearchTool
from retriever import GuestRetrieverTool, docs
# Tools
search_tool = DDGSearchTool()
weather_info_tool = WeatherInfoTool()
hub_stats_tool = HubStatsTool()
guest_info_tool = GuestRetrieverTool(docs)
# Model
model = InferenceClientModel(model_id="HuggingFaceH4/zephyr-7b-beta")
# If needed: InferenceClientModel(model_id="...", token="YOUR_HF_TOKEN")
# Agent
alfred = CodeAgent(
tools=[guest_info_tool, weather_info_tool, hub_stats_tool, search_tool],
model=model,
add_base_tools=True,
planning_interval=3,
)
def respond(message, history):
return alfred.run(message)
demo = gr.ChatInterface(respond)
if __name__ == "__main__":
demo.launch()