CoolFace
Apppublic

susuper/AlfredAgent

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
app.py42 linesDownload Raw Back to root
1import yaml2import os3from smolagents import GradioUI, CodeAgent, HfApiModel4 5# Get current directory path6CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))7 8from tools.final_answer import FinalAnswerTool as FinalAnswer9 10 11 12model = HfApiModel(13max_tokens=2096,14temperature=0.5,15model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud',# it is possible that this model may be overloaded16custom_role_conversions=None,17)18 19final_answer = FinalAnswer()20 21 22with open(os.path.join(CURRENT_DIR, "prompts.yaml"), 'r') as stream:23    prompt_templates = yaml.safe_load(stream)24 25agent = CodeAgent(26    model=model,27    tools=[],28    managed_agents=[],29    max_steps=20,30    verbosity_level=1,31    grammar=None,32    planning_interval=None,33    name="MyAgent",34    description="this is MyAgent",35    executor_type='local',36    executor_kwargs={},37    max_print_outputs_length=None,38    prompt_templates=prompt_templates39)40if __name__ == "__main__":41    GradioUI(agent).launch()42