SilviuMatei commited on
Commit
41c23fb
·
verified ·
1 Parent(s): 6553c90

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -2
app.py CHANGED
@@ -31,7 +31,38 @@ def get_current_time_in_timezone(timezone: str) -> str:
31
  except Exception as e:
32
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
33
 
34
- agent = CodeAgent(tools=[VisitWebpageTool()], model=HfApiModel())
35
 
36
- agent.run("How many seconds would it take for a leopard at full speed to run through Pont des Arts?")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
 
31
  except Exception as e:
32
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
33
 
34
+ agent = CodeAgent(tools=[getDeviceInfo()], model=HfApiModel())
35
 
36
+ agent.run("https://www.google.com")
37
+
38
+ final_answer = FinalAnswerTool()
39
+
40
+ # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
41
+ # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
42
+
43
+ model = HfApiModel(
44
+ max_tokens=2096,
45
+ temperature=0.5,
46
+ model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
47
+ custom_role_conversions=None,
48
+ )
49
+
50
+
51
+ with open("prompts.yaml", 'r') as stream:
52
+ prompt_templates = yaml.safe_load(stream)
53
+
54
+ agent = CodeAgent(
55
+ model=model,
56
+ tools=[final_answer], ## add your tools here (don't remove final answer)
57
+ max_steps=6,
58
+ verbosity_level=1,
59
+ grammar=None,
60
+ planning_interval=None,
61
+ name=None,
62
+ description=None,
63
+ prompt_templates=prompt_templates
64
+ )
65
+
66
+
67
+ GradioUI(agent).launch()
68