aubrigene949 commited on
Commit
6948d83
·
verified ·
1 Parent(s): 42cae44

Update app.py

Browse files

Using self. for variables

Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -17,17 +17,17 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
17
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
18
  class BasicAgent:
19
  def __init__(self):
20
- model = HfApiModel(
21
  max_tokens=2096,
22
  temperature=0.5,
23
  # model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
24
  model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud',
25
  custom_role_conversions=None,
26
  )
27
- final_answer = FinalAnswerTool()
28
- agent = CodeAgent(
29
- model=model,
30
- tools=[final_answer], ## add your tools here (don't remove final answer)
31
  max_steps=6,
32
  verbosity_level=1,
33
  grammar=None,
@@ -41,7 +41,7 @@ class BasicAgent:
41
  print(f"Agent received question (first 50 chars): {question[:50]}...")
42
  fixed_answer = "This is a default answer."
43
  # fixed_answer = agent.run(question)
44
- print(f"Agent answered How are you today as: {this.agent.run('How are you today?')}")
45
  print(f"Agent returning fixed answer: {fixed_answer}")
46
  return fixed_answer
47
 
 
17
  # ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
18
  class BasicAgent:
19
  def __init__(self):
20
+ self.model = HfApiModel(
21
  max_tokens=2096,
22
  temperature=0.5,
23
  # model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded
24
  model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud',
25
  custom_role_conversions=None,
26
  )
27
+ self.final_answer = FinalAnswerTool()
28
+ self.agent = CodeAgent(
29
+ model=self.model,
30
+ tools=[self.final_answer], ## add your tools here (don't remove final answer)
31
  max_steps=6,
32
  verbosity_level=1,
33
  grammar=None,
 
41
  print(f"Agent received question (first 50 chars): {question[:50]}...")
42
  fixed_answer = "This is a default answer."
43
  # fixed_answer = agent.run(question)
44
+ print(f"Agent answered How are you today as: {self.agent.run('How are you today?')}")
45
  print(f"Agent returning fixed answer: {fixed_answer}")
46
  return fixed_answer
47