Spaces:
Sleeping
Sleeping
Tool img
Browse files
app.py
CHANGED
|
@@ -8,7 +8,7 @@ from tools.final_answer import FinalAnswerTool
|
|
| 8 |
#from tools.web_search import DuckDuckGoSearchTool
|
| 9 |
from tools.visit_webpage import VisitWebpageTool
|
| 10 |
from tools.http_search import HttpSearchTool
|
| 11 |
-
from tools.image_wrapper import
|
| 12 |
|
| 13 |
from Gradio_UI import GradioUI
|
| 14 |
|
|
@@ -39,6 +39,17 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 39 |
except Exception as e:
|
| 40 |
return f"Erreur pour le fuseau '{timezone}' : {str(e)}"
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
# ==== Instanciation des tools existants ====
|
| 44 |
|
|
|
|
| 8 |
#from tools.web_search import DuckDuckGoSearchTool
|
| 9 |
from tools.visit_webpage import VisitWebpageTool
|
| 10 |
from tools.http_search import HttpSearchTool
|
| 11 |
+
from tools.image_wrapper import save_image_to_tmp
|
| 12 |
|
| 13 |
from Gradio_UI import GradioUI
|
| 14 |
|
|
|
|
| 39 |
except Exception as e:
|
| 40 |
return f"Erreur pour le fuseau '{timezone}' : {str(e)}"
|
| 41 |
|
| 42 |
+
@tool
|
| 43 |
+
def generate_image_and_save(prompt: str) -> str:
|
| 44 |
+
"""Génère une image via image_generation_tool, la sauvegarde dans /tmp
|
| 45 |
+
et renvoie le chemin du fichier.
|
| 46 |
+
Args:
|
| 47 |
+
prompt: description textuelle de l'image à générer.
|
| 48 |
+
"""
|
| 49 |
+
img = image_generation_tool(prompt=prompt)
|
| 50 |
+
filepath = save_image_to_tmp(img)
|
| 51 |
+
return f"Image sauvegardée dans : {filepath}"
|
| 52 |
+
|
| 53 |
|
| 54 |
# ==== Instanciation des tools existants ====
|
| 55 |
|