Jayashree Sridhar
commited on
Commit
·
21bebf5
1
Parent(s):
1d47c3d
modified voice_tool
Browse files
agents/tools/voice_tools.py
CHANGED
|
@@ -42,10 +42,10 @@ class MultilingualVoiceProcessor:
|
|
| 42 |
class TranscribeAudioTool(BaseTool):
|
| 43 |
name: str = "transcribe_audio"
|
| 44 |
description: str = "Transcribe audio to text and detect language."
|
| 45 |
-
|
| 46 |
def __init__(self, config=None):
|
| 47 |
super().__init__()
|
| 48 |
-
self.
|
| 49 |
def __call__(self, audio_data: np.ndarray, language=None):
|
| 50 |
text, detected_lang = asyncio.run(self.vp.transcribe(audio_data, language))
|
| 51 |
return {"text": text, "language": detected_lang}
|
|
|
|
| 42 |
class TranscribeAudioTool(BaseTool):
|
| 43 |
name: str = "transcribe_audio"
|
| 44 |
description: str = "Transcribe audio to text and detect language."
|
| 45 |
+
_vp: MultilingualVoiceProcessor = PrivateAttr()
|
| 46 |
def __init__(self, config=None):
|
| 47 |
super().__init__()
|
| 48 |
+
self._vp = MultilingualVoiceProcessor()
|
| 49 |
def __call__(self, audio_data: np.ndarray, language=None):
|
| 50 |
text, detected_lang = asyncio.run(self.vp.transcribe(audio_data, language))
|
| 51 |
return {"text": text, "language": detected_lang}
|