manhtd commited on
Commit
0454d84
·
verified ·
1 Parent(s): 29ec968

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -6
app.py CHANGED
@@ -9,14 +9,31 @@ 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_cutom_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 does nothing yet
15
  Args:
16
- arg1: the first argument
17
- arg2: the second argument
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
+ def my_cutom_tool(arg1: str, arg2: int) -> str:
13
+ """A tool that generates a fun fact or trivia based on the input arguments.
 
14
  Args:
15
+ arg1: A topic or keyword for the fact (e.g., 'space', 'history').
16
+ arg2: A number that influences the type or depth of the fact.
17
  """
18
+ facts = {
19
+ "space": [
20
+ "Did you know? A day on Venus is longer than a year on Venus!",
21
+ "Neutron stars are so dense that a sugar-cube-sized amount would weigh about a billion tons on Earth!"
22
+ ],
23
+ "history": [
24
+ "The Eiffel Tower can be 15 cm taller during the summer due to metal expansion.",
25
+ "Ancient Romans used urine as a cleaning agent!"
26
+ ],
27
+ "animals": [
28
+ "An octopus has three hearts and blue blood!",
29
+ "A group of flamingos is called a 'flamboyance'!"
30
+ ]
31
+ }
32
+
33
+ category = arg1.lower()
34
+ if category in facts:
35
+ return facts[category][arg2 % len(facts[category])]
36
+ return "I don't have a fact for that topic yet, but I'm always learning!"
37
 
38
  @tool
39
  def get_current_time_in_timezone(timezone: str) -> str: