namth10 commited on
Commit
cf8f258
·
verified ·
1 Parent(s): 0b30dd0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -8
app.py CHANGED
@@ -9,23 +9,19 @@ from Gradio_UI import GradioUI
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
- def calculate_probability(total_outcomes: int, desired_outcomes: int)-> float: #it's import to specify the return type
13
- #Keep this format for the description / args / args description but feel free to modify the tool
14
  """Calculate the probability of an event in the sample space.
15
 
16
  Args:
17
  total_outcomes: The total number of possible outcomes.
18
  desired_outcomes: The number of desired outcomes.
19
  """
20
- # Kiểm tra xem tổng số kết quả có thể có phải hợp lệ không
21
  if total_outcomes <= 0:
22
  return "Tổng số kết quả có thể phải lớn hơn 0"
23
 
24
- # Kiểm tra xem số lượng kết quả mong muốn có hợp lệ không
25
  if desired_outcomes < 0 or desired_outcomes > total_outcomes:
26
  return "Số kết quả mong muốn không hợp lệ"
27
-
28
- # Tính xác suất
29
  probability = desired_outcomes / total_outcomes
30
  return probability
31
 
@@ -49,7 +45,7 @@ final_answer = FinalAnswerTool()
49
  model = HfApiModel(
50
  max_tokens=2096,
51
  temperature=0.5,
52
- model_id='https://wxknx1kg971u7k1n.us-east-1.aws.endpoints.huggingface.cloud',# it is possible that this model may be overloaded
53
  custom_role_conversions=None,
54
  )
55
 
@@ -62,7 +58,7 @@ with open("prompts.yaml", 'r') as stream:
62
 
63
  agent = CodeAgent(
64
  model=model,
65
- tools=[final_answer], ## add your tools here (don't remove final answer)
66
  max_steps=6,
67
  verbosity_level=1,
68
  grammar=None,
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
+ def calculate_probability(total_outcomes: int, desired_outcomes: int)-> float:
 
13
  """Calculate the probability of an event in the sample space.
14
 
15
  Args:
16
  total_outcomes: The total number of possible outcomes.
17
  desired_outcomes: The number of desired outcomes.
18
  """
 
19
  if total_outcomes <= 0:
20
  return "Tổng số kết quả có thể phải lớn hơn 0"
21
 
 
22
  if desired_outcomes < 0 or desired_outcomes > total_outcomes:
23
  return "Số kết quả mong muốn không hợp lệ"
24
+
 
25
  probability = desired_outcomes / total_outcomes
26
  return probability
27
 
 
45
  model = HfApiModel(
46
  max_tokens=2096,
47
  temperature=0.5,
48
+ model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud',# it is possible that this model may be overloaded
49
  custom_role_conversions=None,
50
  )
51
 
 
58
 
59
  agent = CodeAgent(
60
  model=model,
61
+ tools=[final_answer, calculate_probability], ## add your tools here (don't remove final answer)
62
  max_steps=6,
63
  verbosity_level=1,
64
  grammar=None,