hackmebroo commited on
Commit
21622be
·
verified ·
1 Parent(s): 1d0add8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -13
app.py CHANGED
@@ -9,21 +9,22 @@ 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 days_between_dates(date1: str, date2: str) -> str:
13
- """Calculates how many days are between two dates (YYYY-MM-DD).
14
  Args:
15
- date1: 第一个日期.
16
- date2: 第二个日期.
17
  """
18
- from datetime import datetime
19
- fmt = "%Y-%m-%d"
20
- try:
21
- d1 = datetime.strptime(date1, fmt)
22
- d2 = datetime.strptime(date2, fmt)
23
- delta = abs((d2 - d1).days)
24
- return f"There are {delta} day(s) between {date1} and {date2}."
25
- except Exception as e:
26
- return f"Error: {str(e)}"
 
27
 
28
  @tool
29
  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 random_polyphonic_chars(_: str, __: str) -> str:
13
+ """Generates 10 random Chinese polyphonic characters (多音字).
14
  Args:
15
+ _: Unused argument.
16
+ __: Unused argument.
17
  """
18
+ import random
19
+ polyphonic_chars = [
20
+ "行", "重", "长", "乐", "和",
21
+ "难", "好", "觉", "着", "藏",
22
+ "种", "兴", "发", "都", "还",
23
+ "干", "差", "空", "折", "弹"
24
+ ]
25
+
26
+ selected = random.sample(polyphonic_chars, 10)
27
+ return "随机选出的10个多音字是:" + "、".join(selected)
28
 
29
  @tool
30
  def get_current_time_in_timezone(timezone: str) -> str: