| import gradio as gr |
| from smolagents import CodeAgent, InferenceClientModel |
| from tools import WeatherInfoTool, HubStatsTool, DDGSearchTool |
| from retriever import GuestRetrieverTool, docs |
|
|
| |
| search_tool = DDGSearchTool() |
| weather_info_tool = WeatherInfoTool() |
| hub_stats_tool = HubStatsTool() |
| guest_info_tool = GuestRetrieverTool(docs) |
|
|
| |
| model = InferenceClientModel(model_id="HuggingFaceH4/zephyr-7b-beta") |
| |
|
|
| |
| 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() |
|
|