File size: 761 Bytes
e666150 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | import gradio as gr
import time
from typing import Any, Optional
from smolagents.tools import Tool
from pydub import AudioSegment
from SoundFile import SoundFile
class PlaySomeMusicMeastro(Tool):
name = "prepare_play_music"
description = "Return a SoundFile object so the sounds can be played later to the listener. This tool does not play the music, that will be done in the final answer"
inputs = {'filename': {'type': 'string', 'description': 'The full file name of the song to play.'}}
output_type = "object"
def __init__(self, *args, **kwargs):
super().__init__()
def forward(self, filename: str) -> str:
print(f"Filename to prepare for playing => {filename}")
return SoundFile(f"./downloads/{filename}") |