Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
| 13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 14 |
-
"""
|
|
|
|
| 15 |
Args:
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
| 18 |
"""
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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:
|