This works
This commit is contained in:
@@ -37,7 +37,7 @@ from pipecat.transports.network.webrtc_connection import SmallWebRTCConnection
|
|||||||
load_dotenv(override=True)
|
load_dotenv(override=True)
|
||||||
|
|
||||||
|
|
||||||
class DebugProcessor(FrameProcessor):
|
class AlertProcessor(FrameProcessor):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
@@ -45,9 +45,12 @@ class DebugProcessor(FrameProcessor):
|
|||||||
await super().process_frame(frame, direction)
|
await super().process_frame(frame, direction)
|
||||||
|
|
||||||
if isinstance(frame, TextFrame):
|
if isinstance(frame, TextFrame):
|
||||||
logger.info(f"DebugProcessor received text: {frame.text}")
|
logger.info(f"Alert Processor received text: {frame.text}")
|
||||||
elif isinstance(frame, EndFrame):
|
text = frame.text.strip().upper()
|
||||||
logger.info("DebugProcessor received end frame")
|
if text == "YES":
|
||||||
|
logger.info("Alert: YES")
|
||||||
|
else:
|
||||||
|
logger.info("Alert: NO")
|
||||||
|
|
||||||
await self.push_frame(frame, direction)
|
await self.push_frame(frame, direction)
|
||||||
|
|
||||||
@@ -103,7 +106,7 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection, args: argparse.Names
|
|||||||
|
|
||||||
ir = UserImageRequester()
|
ir = UserImageRequester()
|
||||||
va = VisionImageFrameAggregator()
|
va = VisionImageFrameAggregator()
|
||||||
debug = DebugProcessor()
|
alert = AlertProcessor()
|
||||||
|
|
||||||
pipeline = Pipeline(
|
pipeline = Pipeline(
|
||||||
[
|
[
|
||||||
@@ -112,7 +115,7 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection, args: argparse.Names
|
|||||||
# debug,
|
# debug,
|
||||||
va,
|
va,
|
||||||
moondream,
|
moondream,
|
||||||
# alert_processor, # Send an email alert or something if the door is open
|
alert, # Send an email alert or something if the door is open
|
||||||
transport.output(), # Transport bot output
|
transport.output(), # Transport bot output
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@@ -123,7 +126,7 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection, args: argparse.Names
|
|||||||
DebugLogObserver(
|
DebugLogObserver(
|
||||||
frame_types={
|
frame_types={
|
||||||
# TextFrame: None,
|
# TextFrame: None,
|
||||||
TextFrame: (MoondreamService, FrameEndpoint.DESTINATION),
|
TextFrame: (MoondreamService, FrameEndpoint.SOURCE),
|
||||||
# InputImageRawFrame: None,
|
# InputImageRawFrame: None,
|
||||||
EndFrame: None,
|
EndFrame: None,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,5 @@ class MoondreamService(VisionService):
|
|||||||
return description
|
return description
|
||||||
|
|
||||||
description = await asyncio.to_thread(get_image_description, frame)
|
description = await asyncio.to_thread(get_image_description, frame)
|
||||||
logger.info(f"Image description: {description}")
|
|
||||||
|
|
||||||
yield TextFrame(text=description)
|
yield TextFrame(text=description)
|
||||||
|
|||||||
Reference in New Issue
Block a user