Spaces:
Sleeping
Sleeping
| from smolagents.tools import Tool | |
| class ReadAudioTool(Tool): | |
| name = "read_audio" | |
| description = "Reads an audio file and returns base64 so Gemini can transcribe it." | |
| inputs = { | |
| "file_path": { | |
| "type": "string", | |
| "description": "The full path of the text file to read" | |
| } | |
| } | |
| output_type = "string" | |
| def forward(self, file_path: str) -> str: | |
| with open(file_path, "rb") as aud: | |
| return base64.b64encode(aud.read()).decode("utf-8") | |