Spaces:
Sleeping
Sleeping
Update tools/tools.py
Browse files- tools/tools.py +5 -2
tools/tools.py
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
import os
|
| 2 |
from smolagents import tool
|
| 3 |
import spaces
|
|
|
|
| 4 |
# ----------------------------------------------------------------------------
|
| 5 |
# SECTION 1: Vision & Multimodal
|
| 6 |
# ----------------------------------------------------------------------------
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
|
| 11 |
@tool
|
| 12 |
def vision_tool(prompt: str, image_list: list) -> str:
|
|
@@ -45,6 +45,7 @@ def vision_tool(prompt: str, image_list: list) -> str:
|
|
| 45 |
# ----------------------------------------------------------------------------
|
| 46 |
# SECTION 2: YouTube Pipeline (Tout-en-un pour la robustesse)
|
| 47 |
# ----------------------------------------------------------------------------
|
|
|
|
| 48 |
@tool
|
| 49 |
def ask_youtube_full_pipeline(url: str, question: str) -> str:
|
| 50 |
"""
|
|
@@ -108,6 +109,7 @@ def ask_youtube_full_pipeline(url: str, question: str) -> str:
|
|
| 108 |
# ----------------------------------------------------------------------------
|
| 109 |
# SECTION 3: Fichiers & Audio
|
| 110 |
# ----------------------------------------------------------------------------
|
|
|
|
| 111 |
@tool
|
| 112 |
def read_pdf_file(file_path: str) -> str:
|
| 113 |
"""
|
|
@@ -139,6 +141,7 @@ def read_pdf_file(file_path: str) -> str:
|
|
| 139 |
except Exception as e:
|
| 140 |
return f"Erreur lors de la lecture du fichier PDF : {str(e)}"
|
| 141 |
|
|
|
|
| 142 |
@tool
|
| 143 |
def read_docx_file(file_path: str) -> str:
|
| 144 |
"""
|
|
|
|
| 1 |
import os
|
| 2 |
from smolagents import tool
|
| 3 |
import spaces
|
| 4 |
+
from dotenv import load_dotenv
|
| 5 |
# ----------------------------------------------------------------------------
|
| 6 |
# SECTION 1: Vision & Multimodal
|
| 7 |
# ----------------------------------------------------------------------------
|
| 8 |
|
| 9 |
+
load_dotenv()
|
|
|
|
| 10 |
|
| 11 |
@tool
|
| 12 |
def vision_tool(prompt: str, image_list: list) -> str:
|
|
|
|
| 45 |
# ----------------------------------------------------------------------------
|
| 46 |
# SECTION 2: YouTube Pipeline (Tout-en-un pour la robustesse)
|
| 47 |
# ----------------------------------------------------------------------------
|
| 48 |
+
@spaces.GPU(duration=20)
|
| 49 |
@tool
|
| 50 |
def ask_youtube_full_pipeline(url: str, question: str) -> str:
|
| 51 |
"""
|
|
|
|
| 109 |
# ----------------------------------------------------------------------------
|
| 110 |
# SECTION 3: Fichiers & Audio
|
| 111 |
# ----------------------------------------------------------------------------
|
| 112 |
+
@spaces.GPU(duration=10)
|
| 113 |
@tool
|
| 114 |
def read_pdf_file(file_path: str) -> str:
|
| 115 |
"""
|
|
|
|
| 141 |
except Exception as e:
|
| 142 |
return f"Erreur lors de la lecture du fichier PDF : {str(e)}"
|
| 143 |
|
| 144 |
+
@spaces.GPU(duration=10)
|
| 145 |
@tool
|
| 146 |
def read_docx_file(file_path: str) -> str:
|
| 147 |
"""
|