Open poojitharamachandra opened 9 months ago
What does the play_answer function look like? Hard to debug without the code.
import pygame async def play_soundfile():
#playsound.playsound('./ans.wav')
# Initialize the mixer module for audio playback
pygame.mixer.init()
# Load the audio file
pygame.mixer.music.load(wavefile)
# Play the audio
pygame.mixer.music.play()
# Wait for the audio to finish playing (optional)
while pygame.mixer.music.get_busy():
pygame.time.Clock().tick(10)
# Release the audio resources
pygame.mixer.quit()
Can you try to wrap the function call like this await cl.make_async(play_answer)(res['result'])
?
if i wrap the function, the soundclip is not being played and i get the following error :
RuntimeWarning: coroutine 'play_answer' was never awaited self.run() RuntimeWarning: Enable tracemalloc to get the object allocation traceback
is the play_answer function marked as async? If that is the case are you doing any await in it?
async def play_answer(text): await play_soundfile()
hi,
i have a code something like this:
@cl.on_message async def run(input_str): ........................... ............................... await play_answer(res['result'])
await cl.Message(content=fnl_ans).send()
but only play_answer is getting executed, but i dont see the fnl_ans on the chainlit UI. the execution of the whole code is also blocked