sanchitsarangal's picture
Upload 2 files
3d878cb verified
Raw
History Blame
820 Bytes
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()