Spaces:
Build error
Build error
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
Simple SmoLAgent - Un script simple pour tester l'authentification avec Hugging Face | |
""" | |
import os | |
import asyncio | |
from dotenv import load_dotenv | |
from huggingface_hub import login | |
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel | |
# Charger les variables d'environnement depuis le fichier .env | |
load_dotenv() | |
# Récupérer le token Hugging Face | |
hf_token = os.getenv("HUGGING_FACE_HUB_TOKEN") | |
def main(): | |
"""Fonction principale pour tester l'authentification avec Hugging Face.""" | |
agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=HfApiModel()) | |
response = agent.run("Search for the best music recommendations for a party at the Wayne's mansion.") | |
# Tester l'agent avec une requête simple | |
print(f"Réponse de l'agent: {response}") | |
if __name__ == "__main__": | |
main() | |