File size: 820 Bytes
10e9b7d 3d878cb 10e9b7d 3d878cb e80aab9 3d878cb 31243f4 3d878cb e80aab9 3d878cb e80aab9 3d878cb e80aab9 3d878cb | 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 | import os
from smolagents import CodeAgent, HfHubProvider, GradioUI
# 1. Hugging Face ka standard open-source model select kiya
provider = HfHubProvider(model_id="Qwen/Qwen2.5-Coder-32B-Instruct")
# 2. Ek simple valid tool define kiya course evaluation clear karne ke liye
def web_search_mock(query: str) -> str:
"""A search tool that helps the agent find information.
Args:
query: The search query string.
"""
return f"Search result for '{query}': This is a placeholder response for the agent evaluation."
# 3. Agent ko properly initialize kiya
agent = CodeAgent(
tools=[web_search_mock],
model=provider,
additional_authorized_imports=["requests", "bs4", "math"]
)
# 4. Gradio UI interface launch kiya jo Space par dikhega
if __name__ == "__main__":
GradioUI(agent).launch()
|