TinyKat commited on
Commit
f62eca0
·
verified ·
1 Parent(s): 80dea75

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -6
app.py CHANGED
@@ -9,14 +9,33 @@ 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_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 checks local time (EAT) and greets you accordingly
 
15
  Args:
16
- arg1: A string representing the current local time and salutation
17
- arg2: An int giving the local time
 
 
 
 
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
+ @tool
13
+ def time_greeting_tool(time_zone: str, hour: int = None) -> str:
14
+ """A tool that checks local time and greets you accordingly.
15
+
16
  Args:
17
+ time_zone: A string representing the time zone (e.g., 'EAT', 'EST', 'PST')
18
+ hour: An optional integer representing the current hour (0-23).
19
+ If not provided, uses current system time.
20
+
21
+ Returns:
22
+ A greeting message based on the time of day in the specified time zone.
23
  """
24
+ # If hour is not provided, use current system time
25
+ if hour is None:
26
+ hour = datetime.now().hour
27
+
28
+ # Simple time-based greetings
29
+ if 5 <= hour < 12:
30
+ time_of_day = "morning"
31
+ elif 12 <= hour < 17:
32
+ time_of_day = "afternoon"
33
+ elif 17 <= hour < 21:
34
+ time_of_day = "evening"
35
+ else:
36
+ time_of_day = "night"
37
+
38
+ return f"Good {time_of_day}! It's currently hour {hour} in {time_zone} time zone."
39
 
40
  @tool
41
  def get_current_time_in_timezone(timezone: str) -> str: