namth10 commited on
Commit
200c905
·
verified ·
1 Parent(s): 9a8c112

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -5
app.py CHANGED
@@ -9,14 +9,28 @@ 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 my_cutom_tool(arg1:str, arg2:int)-> str: #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
- """A tool that does nothing yet
 
15
  Args:
16
- arg1: the first argument
17
- arg2: the second argument
 
 
 
18
  """
19
- return "What magic will you build ?"
 
 
 
 
 
 
 
 
 
 
20
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
 
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 (int): The total number of possible outcomes.
18
+ desired_outcomes (int): The number of desired outcomes.
19
+
20
+ Returns:
21
+ float: The probability of the event.
22
  """
23
+ # Kiểm tra xem tổng số kết quả có thể có phải hợp lệ không
24
+ if total_outcomes <= 0:
25
+ return "Tổng số kết quả có thể phải lớn hơn 0"
26
+
27
+ # Kiểm tra xem số lượng kết quả mong muốn có hợp lệ không
28
+ if desired_outcomes < 0 or desired_outcomes > total_outcomes:
29
+ return "Số kết quả mong muốn không hợp lệ"
30
+
31
+ # Tính xác suất
32
+ probability = desired_outcomes / total_outcomes
33
+ return probability
34
 
35
  @tool
36
  def get_current_time_in_timezone(timezone: str) -> str: