Spaces:
Running
Running
Update customtools.py
Browse files- customtools.py +4 -4
customtools.py
CHANGED
|
@@ -69,7 +69,7 @@ def youtube_transcript(url: str) -> str:
|
|
| 69 |
else:
|
| 70 |
video_id=video_id_match.group(1)
|
| 71 |
#print(YouTubeTranscriptApi.__getattribute__())
|
| 72 |
-
print(video_id)
|
| 73 |
try:
|
| 74 |
transcript = YouTubeTranscriptApi().fetch(video_id)
|
| 75 |
text = "\n".join(piece.text for piece in transcript.snippets)
|
|
@@ -171,10 +171,9 @@ def modulus_tool(a: int, b: int) -> int:
|
|
| 171 |
a: first int
|
| 172 |
b: second int
|
| 173 |
"""
|
| 174 |
-
result = a % b
|
| 175 |
return str(result)
|
| 176 |
|
| 177 |
-
|
| 178 |
@tool
|
| 179 |
def power_tool(a: float, b: float) -> float:
|
| 180 |
"""Get the power of two numbers.
|
|
@@ -186,7 +185,6 @@ def power_tool(a: float, b: float) -> float:
|
|
| 186 |
return str(result)
|
| 187 |
|
| 188 |
|
| 189 |
-
|
| 190 |
@tool
|
| 191 |
def extract_text_from_image(image_path: str) -> str:
|
| 192 |
"""
|
|
@@ -261,6 +259,7 @@ def load_and_analyze_excel_file(query: str, file_path: str) -> str:
|
|
| 261 |
query=query
|
| 262 |
)
|
| 263 |
tool_llm=None
|
|
|
|
| 264 |
if NVIDIA:
|
| 265 |
tool_llm = ChatNVIDIA(
|
| 266 |
model=NVIDIA_MODEL,
|
|
@@ -300,3 +299,4 @@ def transcribe_audio(audio_file: str) -> str:
|
|
| 300 |
except Exception as exc:
|
| 301 |
print(f"Error transcribing audio: {exc}")
|
| 302 |
return f"transcription_error:{exc}"
|
|
|
|
|
|
| 69 |
else:
|
| 70 |
video_id=video_id_match.group(1)
|
| 71 |
#print(YouTubeTranscriptApi.__getattribute__())
|
| 72 |
+
#print(video_id)
|
| 73 |
try:
|
| 74 |
transcript = YouTubeTranscriptApi().fetch(video_id)
|
| 75 |
text = "\n".join(piece.text for piece in transcript.snippets)
|
|
|
|
| 171 |
a: first int
|
| 172 |
b: second int
|
| 173 |
"""
|
| 174 |
+
result = a % b
|
| 175 |
return str(result)
|
| 176 |
|
|
|
|
| 177 |
@tool
|
| 178 |
def power_tool(a: float, b: float) -> float:
|
| 179 |
"""Get the power of two numbers.
|
|
|
|
| 185 |
return str(result)
|
| 186 |
|
| 187 |
|
|
|
|
| 188 |
@tool
|
| 189 |
def extract_text_from_image(image_path: str) -> str:
|
| 190 |
"""
|
|
|
|
| 259 |
query=query
|
| 260 |
)
|
| 261 |
tool_llm=None
|
| 262 |
+
|
| 263 |
if NVIDIA:
|
| 264 |
tool_llm = ChatNVIDIA(
|
| 265 |
model=NVIDIA_MODEL,
|
|
|
|
| 299 |
except Exception as exc:
|
| 300 |
print(f"Error transcribing audio: {exc}")
|
| 301 |
return f"transcription_error:{exc}"
|
| 302 |
+
|