Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,8 @@ import yaml
|
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
|
|
|
|
|
|
| 9 |
|
| 10 |
@tool
|
| 11 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
|
@@ -32,7 +34,6 @@ def generate_image_with_prompt(prompt: str) -> str:
|
|
| 32 |
@tool
|
| 33 |
def random_fact() -> str:
|
| 34 |
"""Fetches a random fun fact."""
|
| 35 |
-
import random
|
| 36 |
facts = [
|
| 37 |
"Honey never spoils.",
|
| 38 |
"Octopuses have three hearts.",
|
|
@@ -42,16 +43,17 @@ def random_fact() -> str:
|
|
| 42 |
|
| 43 |
|
| 44 |
@tool
|
| 45 |
-
def tell_joke()-> str:
|
| 46 |
"""Returns a random joke."""
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
|
|
|
| 55 |
|
| 56 |
@tool
|
| 57 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
+
import random
|
| 10 |
+
|
| 11 |
|
| 12 |
@tool
|
| 13 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
|
|
|
| 34 |
@tool
|
| 35 |
def random_fact() -> str:
|
| 36 |
"""Fetches a random fun fact."""
|
|
|
|
| 37 |
facts = [
|
| 38 |
"Honey never spoils.",
|
| 39 |
"Octopuses have three hearts.",
|
|
|
|
| 43 |
|
| 44 |
|
| 45 |
@tool
|
| 46 |
+
def tell_joke() -> str:
|
| 47 |
"""Returns a random joke."""
|
| 48 |
+
try:
|
| 49 |
+
jokes = [
|
| 50 |
+
"Why don't skeletons fight each other? They don't have the guts.",
|
| 51 |
+
"I told my wife she was drawing her eyebrows too high. She looked surprised.",
|
| 52 |
+
"Why don’t scientists trust atoms? Because they make up everything!"
|
| 53 |
+
]
|
| 54 |
+
return random.choice(jokes)
|
| 55 |
+
except Exception as e:
|
| 56 |
+
return f"Error fetching joke: {str(e)}"
|
| 57 |
|
| 58 |
@tool
|
| 59 |
def get_current_time_in_timezone(timezone: str) -> str:
|