Spaces:
Sleeping
Sleeping
techy-ai commited on
Commit ·
25c43c2
1
Parent(s): 7eaca8c
runtime error fixed
Browse files
agent.py
CHANGED
|
@@ -178,30 +178,7 @@ def square_root(a: float) -> float|complex:
|
|
| 178 |
except Exception as e:
|
| 179 |
logger.error("square_root failed: %s", str(e))
|
| 180 |
return tool_response(False, error=f"Invalid input: {e}")
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
### =============== Audio TOOLS =============== ###
|
| 184 |
-
|
| 185 |
-
# @tool("extract_text_from_audio", return_direct=True)
|
| 186 |
-
# def extract_text_from_audio(audio_file_path: str) -> str:
|
| 187 |
-
# """
|
| 188 |
-
# Extract text from an audio file using speech recognition.
|
| 189 |
-
# Args:
|
| 190 |
-
# audio_file_path (str): Path to the audio file (wav, mp3, etc.)
|
| 191 |
-
# Returns:
|
| 192 |
-
# str: Transcribed text from the audio.
|
| 193 |
-
# """
|
| 194 |
-
# recognizer = sr.Recognizer()
|
| 195 |
-
# with sr.AudioFile(audio_file_path) as source:
|
| 196 |
-
# audio = recognizer.record(source)
|
| 197 |
-
# try:
|
| 198 |
-
# # Use Whisper (local) recognizer as recommended by SpeechRecognition[whisper-local]
|
| 199 |
-
# text = recognizer.recognize_whisper(audio)
|
| 200 |
-
# except sr.UnknownValueError:
|
| 201 |
-
# text = "Could not understand audio."
|
| 202 |
-
# except sr.RequestError as e:
|
| 203 |
-
# text = f"Recognition error: {e}"
|
| 204 |
-
# return text
|
| 205 |
|
| 206 |
# =========================
|
| 207 |
# 📂 File Tools
|
|
|
|
| 178 |
except Exception as e:
|
| 179 |
logger.error("square_root failed: %s", str(e))
|
| 180 |
return tool_response(False, error=f"Invalid input: {e}")
|
| 181 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
|
| 183 |
# =========================
|
| 184 |
# 📂 File Tools
|