Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,38 +8,7 @@ from tools.final_answer import FinalAnswerTool
|
|
| 8 |
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 name_generator(mom: str, dad: str) -> list:
|
| 13 |
-
"""
|
| 14 |
-
Generate baby names based on parental preferences.
|
| 15 |
-
|
| 16 |
-
Args:
|
| 17 |
-
mom (str): The mother's preferences for the name (e.g., "classic", "modern", "French names").
|
| 18 |
-
dad (str): The father's preferences for the name (e.g., "hero names", "Corsican names", "short names").
|
| 19 |
-
|
| 20 |
-
Returns:
|
| 21 |
-
list: A list of baby names that match the given preferences.
|
| 22 |
-
"""
|
| 23 |
-
# Création du prompt pour générer plusieurs prénoms
|
| 24 |
-
prompt = f"""
|
| 25 |
-
You are an AI that suggests baby names based on parental preferences.
|
| 26 |
-
The mother prefers: {mom}.
|
| 27 |
-
The father prefers: {dad}.
|
| 28 |
-
|
| 29 |
-
Suggest as many baby names as possible.
|
| 30 |
-
Just return the names, separated by commas, nothing else.
|
| 31 |
-
"""
|
| 32 |
-
|
| 33 |
-
# Envoi de la requête au modèle
|
| 34 |
-
response = model.generate(prompt)
|
| 35 |
-
|
| 36 |
-
# Nettoyage et transformation en liste
|
| 37 |
-
baby_names = response.strip().split(",") # Sépare les prénoms par virgule
|
| 38 |
-
|
| 39 |
-
# Nettoyer chaque prénom (enlever espaces inutiles)
|
| 40 |
-
baby_names = [name.strip() for name in baby_names if name.strip()]
|
| 41 |
|
| 42 |
-
return baby_names if baby_names else ["No names generated. Try different preferences."]
|
| 43 |
|
| 44 |
@tool
|
| 45 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
|
|
|
| 12 |
|
| 13 |
@tool
|
| 14 |
def get_current_time_in_timezone(timezone: str) -> str:
|