Update app.py
#550
by
Cankan
- opened
app.py
CHANGED
|
@@ -9,14 +9,21 @@ 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:
|
| 13 |
-
|
| 14 |
-
"""A tool that does nothing yet
|
| 15 |
Args:
|
| 16 |
-
arg1:
|
| 17 |
-
arg2:
|
| 18 |
"""
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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_custom_tool(arg1: str, arg2: int) -> str:
|
| 13 |
+
"""A tool that changes your height from metric to imperial
|
|
|
|
| 14 |
Args:
|
| 15 |
+
arg1: your name
|
| 16 |
+
arg2: your height in metric system (centimeters)
|
| 17 |
"""
|
| 18 |
+
afeet = 30.48 # cm per foot
|
| 19 |
+
ainch = 2.54 # cm per inch
|
| 20 |
+
|
| 21 |
+
# just truncate feet (no decimals)
|
| 22 |
+
the_feet = int(arg2 // afeet) # floor/truncate to whole feet
|
| 23 |
+
remainder = arg2 - the_feet * afeet # leftover cm after whole feet
|
| 24 |
+
the_inch = remainder / ainch # inches from leftover
|
| 25 |
+
|
| 26 |
+
return f"Height of {arg1} in imperial units: {the_feet} ft {the_inch:.2f} in"
|
| 27 |
|
| 28 |
@tool
|
| 29 |
def get_current_time_in_timezone(timezone: str) -> str:
|