Spaces:
Sleeping
Sleeping
techy-ai commited on
Commit ·
2f4fe39
1
Parent(s): 8213688
module pyaudio removed
Browse files
agent.py
CHANGED
|
@@ -20,7 +20,7 @@ interpreter_instance = CodeInterpreter()
|
|
| 20 |
from image_processing import *
|
| 21 |
|
| 22 |
from langchain_core.tools import tool
|
| 23 |
-
import speech_recognition as sr
|
| 24 |
|
| 25 |
"""Langraph"""
|
| 26 |
from langgraph.graph import START, StateGraph, MessagesState
|
|
@@ -182,26 +182,26 @@ def square_root(a: float) -> float|complex:
|
|
| 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 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
|
| 206 |
# =========================
|
| 207 |
# 📂 File Tools
|
|
|
|
| 20 |
from image_processing import *
|
| 21 |
|
| 22 |
from langchain_core.tools import tool
|
| 23 |
+
# import speech_recognition as sr
|
| 24 |
|
| 25 |
"""Langraph"""
|
| 26 |
from langgraph.graph import START, StateGraph, MessagesState
|
|
|
|
| 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
|