Spaces:
Sleeping
Sleeping
File size: 507 Bytes
d190aeb bb4b0e1 d190aeb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
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")
|