From 42f5ec20f6b87550e6889a528b83f20ee13bdc27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Wed, 11 Dec 2024 10:46:38 -0800 Subject: [PATCH] examples: fixes for moondream-chatbot and studypal --- examples/moondream-chatbot/bot.py | 15 ++++++++------- examples/studypal/studypal.py | 4 +--- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/examples/moondream-chatbot/bot.py b/examples/moondream-chatbot/bot.py index b095acf6b..54c2013b4 100644 --- a/examples/moondream-chatbot/bot.py +++ b/examples/moondream-chatbot/bot.py @@ -13,13 +13,13 @@ from PIL import Image from pipecat.audio.vad.silero import SileroVADAnalyzer from pipecat.frames.frames import ( + BotStartedSpeakingFrame, + BotStoppedSpeakingFrame, ImageRawFrame, OutputImageRawFrame, SpriteFrame, Frame, LLMMessagesFrame, - TTSAudioRawFrame, - TTSStoppedFrame, TextFrame, UserImageRawFrame, UserImageRequestFrame, @@ -83,14 +83,15 @@ class TalkingAnimation(FrameProcessor): async def process_frame(self, frame: Frame, direction: FrameDirection): await super().process_frame(frame, direction) - if isinstance(frame, TTSAudioRawFrame): + if isinstance(frame, BotStartedSpeakingFrame): if not self._is_talking: await self.push_frame(talking_frame) self._is_talking = True - elif isinstance(frame, TTSStoppedFrame): + elif isinstance(frame, BotStoppedSpeakingFrame): await self.push_frame(quiet_frame) self._is_talking = False - await self.push_frame(frame) + + await self.push_frame(frame, direction) class UserImageRequester(FrameProcessor): @@ -126,7 +127,7 @@ class TextFilterProcessor(FrameProcessor): if frame.text != self.text: await self.push_frame(frame) else: - await self.push_frame(frame) + await self.push_frame(frame, direction) class ImageFilterProcessor(FrameProcessor): @@ -134,7 +135,7 @@ class ImageFilterProcessor(FrameProcessor): await super().process_frame(frame, direction) if not isinstance(frame, ImageRawFrame): - await self.push_frame(frame) + await self.push_frame(frame, direction) async def main(): diff --git a/examples/studypal/studypal.py b/examples/studypal/studypal.py index 1ec165069..bccd7ad27 100644 --- a/examples/studypal/studypal.py +++ b/examples/studypal/studypal.py @@ -128,9 +128,7 @@ async def main(): api_key=os.getenv("CARTESIA_API_KEY"), voice_id=os.getenv("CARTESIA_VOICE_ID", "4d2fd738-3b3d-4368-957a-bb4805275bd9"), # British Narration Lady: 4d2fd738-3b3d-4368-957a-bb4805275bd9 - params=CartesiaTTSService.InputParams( - sample_rate=44100, - ), + sample_rate=44100, ) llm = OpenAILLMService(api_key=os.getenv("OPENAI_API_KEY"), model="gpt-4o-mini")