Spaces:
Sleeping
Sleeping
Update app.py
#1
by
Melody923
- opened
app.py
CHANGED
|
@@ -11,12 +11,25 @@ from Gradio_UI import GradioUI
|
|
| 11 |
@tool
|
| 12 |
def my_custom_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
|
| 15 |
Args:
|
| 16 |
-
arg1:
|
| 17 |
-
arg2:
|
| 18 |
"""
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 11 |
@tool
|
| 12 |
def my_custom_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 generates a personalized message based on the input arguments.
|
| 15 |
Args:
|
| 16 |
+
arg1: The first argument, which is used as a name or identifier.
|
| 17 |
+
arg2: The second argument, which is used to determine the type of message.
|
| 18 |
"""
|
| 19 |
+
creative_responses = {
|
| 20 |
+
1: f"Hello, {arg1}! Today is a great day to chase your dreams!",
|
| 21 |
+
2: f"{arg1}, you are on the brink of something amazing! Keep pushing forward.",
|
| 22 |
+
3: f"Good news, {arg1}! Your hard work is about to pay off.",
|
| 23 |
+
4: f"{arg1}, you are one step closer to achieving your goals.",
|
| 24 |
+
5: f"Hi, {arg1}! Remember, every small step counts."
|
| 25 |
+
}
|
| 26 |
+
# Check if arg2 is within the range of our responses
|
| 27 |
+
if arg2 in creative_responses:
|
| 28 |
+
return creative_responses[arg2]
|
| 29 |
+
else:
|
| 30 |
+
# If arg2 is not in the range, generate a random creative message
|
| 31 |
+
random_message = random.choice(list(creative_responses.values()))
|
| 32 |
+
return f"{arg1}, here's a surprise message for you: {random_message}"
|
| 33 |
|
| 34 |
@tool
|
| 35 |
def get_current_time_in_timezone(timezone: str) -> str:
|