Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,17 +14,6 @@ import soundfile as sf
|
|
| 14 |
import os
|
| 15 |
import numpy as np
|
| 16 |
|
| 17 |
-
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 18 |
-
@tool
|
| 19 |
-
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
| 20 |
-
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 21 |
-
"""A tool that does nothing yet
|
| 22 |
-
Args:
|
| 23 |
-
arg1: the first argument
|
| 24 |
-
arg2: the second argument
|
| 25 |
-
"""
|
| 26 |
-
return "What magic will you build ?"
|
| 27 |
-
|
| 28 |
|
| 29 |
# Initialize the Kokoro pipeline
|
| 30 |
pipeline = KPipeline(lang_code='a') # 'a' stands for American English
|
|
@@ -85,40 +74,6 @@ def search_dad_jokes(term: str) -> str:
|
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
-
@tool
|
| 89 |
-
def get_random_cocktail() -> str:
|
| 90 |
-
"""A tool that fetches a random cocktail recipe.
|
| 91 |
-
"""
|
| 92 |
-
try:
|
| 93 |
-
response = requests.get('https://www.thecocktaildb.com/api/json/v1/1/random.php')
|
| 94 |
-
data = response.json()
|
| 95 |
-
if data and 'drinks' in data:
|
| 96 |
-
drink = data['drinks'][0]
|
| 97 |
-
cocktail_name = drink['strDrink']
|
| 98 |
-
ingredients = [drink[f'strIngredient{i}'] for i in range(1, 16) if drink[f'strIngredient{i}']]
|
| 99 |
-
instructions = drink['strInstructions']
|
| 100 |
-
return f"Cocktail: {cocktail_name}\nIngredients: {', '.join(ingredients)}\nInstructions: {instructions}"
|
| 101 |
-
else:
|
| 102 |
-
return "No cocktail found. Please try again."
|
| 103 |
-
except Exception as e:
|
| 104 |
-
return f"Error fetching random cocktail: {str(e)}"
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
@tool
|
| 108 |
-
def get_current_time_in_timezone(timezone: str) -> str:
|
| 109 |
-
"""A tool that fetches the current local time in a specified timezone.
|
| 110 |
-
Args:
|
| 111 |
-
timezone: A string representing a valid timezone (e.g., 'America/New_York').
|
| 112 |
-
"""
|
| 113 |
-
try:
|
| 114 |
-
# Create timezone object
|
| 115 |
-
tz = pytz.timezone(timezone)
|
| 116 |
-
# Get current time in that timezone
|
| 117 |
-
local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
| 118 |
-
return f"The current local time in {timezone} is: {local_time}"
|
| 119 |
-
except Exception as e:
|
| 120 |
-
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 121 |
-
|
| 122 |
|
| 123 |
final_answer = FinalAnswerTool()
|
| 124 |
web_search_tool = DuckDuckGoSearchTool()
|
|
|
|
| 14 |
import os
|
| 15 |
import numpy as np
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
# Initialize the Kokoro pipeline
|
| 19 |
pipeline = KPipeline(lang_code='a') # 'a' stands for American English
|
|
|
|
| 74 |
|
| 75 |
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
final_answer = FinalAnswerTool()
|
| 79 |
web_search_tool = DuckDuckGoSearchTool()
|