Merge pull request #836 from pipecat-ai/aleix/moondream-studypal-fixes
examples: fixes for moondream-chatbot and studypal
This commit is contained in:
@@ -13,13 +13,13 @@ from PIL import Image
|
|||||||
|
|
||||||
from pipecat.audio.vad.silero import SileroVADAnalyzer
|
from pipecat.audio.vad.silero import SileroVADAnalyzer
|
||||||
from pipecat.frames.frames import (
|
from pipecat.frames.frames import (
|
||||||
|
BotStartedSpeakingFrame,
|
||||||
|
BotStoppedSpeakingFrame,
|
||||||
ImageRawFrame,
|
ImageRawFrame,
|
||||||
OutputImageRawFrame,
|
OutputImageRawFrame,
|
||||||
SpriteFrame,
|
SpriteFrame,
|
||||||
Frame,
|
Frame,
|
||||||
LLMMessagesFrame,
|
LLMMessagesFrame,
|
||||||
TTSAudioRawFrame,
|
|
||||||
TTSStoppedFrame,
|
|
||||||
TextFrame,
|
TextFrame,
|
||||||
UserImageRawFrame,
|
UserImageRawFrame,
|
||||||
UserImageRequestFrame,
|
UserImageRequestFrame,
|
||||||
@@ -83,14 +83,15 @@ class TalkingAnimation(FrameProcessor):
|
|||||||
async def process_frame(self, frame: Frame, direction: FrameDirection):
|
async def process_frame(self, frame: Frame, direction: FrameDirection):
|
||||||
await super().process_frame(frame, direction)
|
await super().process_frame(frame, direction)
|
||||||
|
|
||||||
if isinstance(frame, TTSAudioRawFrame):
|
if isinstance(frame, BotStartedSpeakingFrame):
|
||||||
if not self._is_talking:
|
if not self._is_talking:
|
||||||
await self.push_frame(talking_frame)
|
await self.push_frame(talking_frame)
|
||||||
self._is_talking = True
|
self._is_talking = True
|
||||||
elif isinstance(frame, TTSStoppedFrame):
|
elif isinstance(frame, BotStoppedSpeakingFrame):
|
||||||
await self.push_frame(quiet_frame)
|
await self.push_frame(quiet_frame)
|
||||||
self._is_talking = False
|
self._is_talking = False
|
||||||
await self.push_frame(frame)
|
|
||||||
|
await self.push_frame(frame, direction)
|
||||||
|
|
||||||
|
|
||||||
class UserImageRequester(FrameProcessor):
|
class UserImageRequester(FrameProcessor):
|
||||||
@@ -126,7 +127,7 @@ class TextFilterProcessor(FrameProcessor):
|
|||||||
if frame.text != self.text:
|
if frame.text != self.text:
|
||||||
await self.push_frame(frame)
|
await self.push_frame(frame)
|
||||||
else:
|
else:
|
||||||
await self.push_frame(frame)
|
await self.push_frame(frame, direction)
|
||||||
|
|
||||||
|
|
||||||
class ImageFilterProcessor(FrameProcessor):
|
class ImageFilterProcessor(FrameProcessor):
|
||||||
@@ -134,7 +135,7 @@ class ImageFilterProcessor(FrameProcessor):
|
|||||||
await super().process_frame(frame, direction)
|
await super().process_frame(frame, direction)
|
||||||
|
|
||||||
if not isinstance(frame, ImageRawFrame):
|
if not isinstance(frame, ImageRawFrame):
|
||||||
await self.push_frame(frame)
|
await self.push_frame(frame, direction)
|
||||||
|
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
|
|||||||
@@ -128,9 +128,7 @@ async def main():
|
|||||||
api_key=os.getenv("CARTESIA_API_KEY"),
|
api_key=os.getenv("CARTESIA_API_KEY"),
|
||||||
voice_id=os.getenv("CARTESIA_VOICE_ID", "4d2fd738-3b3d-4368-957a-bb4805275bd9"),
|
voice_id=os.getenv("CARTESIA_VOICE_ID", "4d2fd738-3b3d-4368-957a-bb4805275bd9"),
|
||||||
# British Narration Lady: 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")
|
llm = OpenAILLMService(api_key=os.getenv("OPENAI_API_KEY"), model="gpt-4o-mini")
|
||||||
|
|||||||
Reference in New Issue
Block a user