electricwapiti commited on
Commit
8e2afca
·
verified ·
1 Parent(s): ae7a494

update app.py with two tools that I found online

Browse files
Files changed (1) hide show
  1. app.py +40 -1
app.py CHANGED
@@ -9,6 +9,46 @@ 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 does nothing yet
@@ -17,7 +57,6 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
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:
23
  """A tool that fetches the current local time in a specified timezone.
 
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
+ def water_phase(arg1: 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 show the phase of water at a given temperature
15
+ Args:
16
+ arg1: the number representing temperature in Celsius
17
+ """
18
+ if arg1 < 0:
19
+ return "Ice"
20
+ if 0 <= arg1 <= 100:
21
+ return "Water"
22
+ if arg1 > 100:
23
+ return "Vapor"
24
+
25
+ # Below is an example of a tool that does nothing. Amaze us with your creativity !
26
+ @tool
27
+ def create_new_vday_card_tool(theme:str) -> str: #it's import to specify the return type
28
+ #Keep this format for the description / args / args description but feel free to modify the tool
29
+ """A tool that generates a custom Valentine's Day card based on a given theme.
30
+ Args:
31
+ theme: A string representing the theme for the Valentine's Day card.
32
+ """
33
+ try:
34
+ #Import tool from Hub
35
+ ...
36
+ image_gereration_tool = Tool.from_space(
37
+ space_id="black-forest-labs/FLUX.1-schnell",
38
+ name="generate image",
39
+ description="Generate image from prompt"
40
+ )
41
+ ...
42
+ image_generation_tool = load_tool("agents-couse/text-to-image", trust_remote_code=True)
43
+ image = image_generation_tool(theme)
44
+ return final_answer(image)
45
+ except Exception as e:
46
+ return f"Error creating card for theme '{theme}': {str(e)}"
47
+ #image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
48
+
49
+
50
+ # Below is an example of a tool that does nothing. Amaze us with your creativity !
51
+ @tool
52
  def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
53
  #Keep this format for the description / args / args description but feel free to modify the tool
54
  """A tool that does nothing yet
 
57
  arg2: the second argument
58
  """
59
  return "What magic will you build ?"
 
60
  @tool
61
  def get_current_time_in_timezone(timezone: str) -> str:
62
  """A tool that fetches the current local time in a specified timezone.