| 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}") |