Spaces:
Sleeping
Sleeping
Update app.py
Browse filesadd another tool
app.py
CHANGED
|
@@ -10,14 +10,32 @@ from Gradio_UI import GradioUI
|
|
| 10 |
|
| 11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 12 |
@tool
|
| 13 |
-
def
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
Args:
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
| 19 |
"""
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
@tool
|
| 23 |
def get_a_joke(keyword: str = None) -> str:
|
|
|
|
| 10 |
|
| 11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 12 |
@tool
|
| 13 |
+
def get_chinese_zodiac_sign(year: int = None) -> str:
|
| 14 |
+
"""
|
| 15 |
+
A tool that translates a Gregorian year into its corresponding Chinese Zodiac animal sign.
|
| 16 |
+
|
| 17 |
+
The Chinese Zodiac cycle is based on a 12-year cycle, with each year
|
| 18 |
+
assigned to an animal. The cycle starts with the Rat.
|
| 19 |
+
|
| 20 |
Args:
|
| 21 |
+
year (int): The Gregorian calendar year (e.g., 1997, 2025).
|
| 22 |
+
|
| 23 |
+
Returns:
|
| 24 |
+
str: The name of the Chinese Zodiac animal sign.
|
| 25 |
"""
|
| 26 |
+
|
| 27 |
+
# 1. List of 12 animals in order, starting with Rat
|
| 28 |
+
zodiac_signs = [
|
| 29 |
+
"Rat", "Ox", "Tiger", "Rabbit", "Dragon", "Snake",
|
| 30 |
+
"Horse", "Goat", "Monkey", "Rooster", "Dog", "Pig"
|
| 31 |
+
]
|
| 32 |
+
|
| 33 |
+
# 2. Calculate the index: 1900 was the year of the Rat (index 0).
|
| 34 |
+
# The modulo 12 operation ensures the index wraps around correctly.
|
| 35 |
+
index = (year - 1900) % 12
|
| 36 |
+
|
| 37 |
+
# 3. Return the animal sign at the calculated index
|
| 38 |
+
return zodiac_signs[index]
|
| 39 |
|
| 40 |
@tool
|
| 41 |
def get_a_joke(keyword: str = None) -> str:
|