Fix 06a-image-sync.py

This commit is contained in:
Moishe Lettvin
2024-01-29 14:29:32 -05:00
parent 065a213ebb
commit d0bcddfd70
3 changed files with 56 additions and 57 deletions

View File

@@ -1,6 +1,8 @@
import argparse import argparse
import asyncio import asyncio
import os
from typing import AsyncGenerator from typing import AsyncGenerator
import aiohttp
import requests import requests
import time import time
import urllib.parse import urllib.parse
@@ -30,10 +32,7 @@ class ImageSyncAggregator(AIService):
async def main(room_url: str, token): async def main(room_url: str, token):
global transport async with aiohttp.ClientSession() as aiohttp_session:
global llm
global tts
transport = DailyTransportService( transport = DailyTransportService(
room_url, room_url,
token, token,
@@ -48,7 +47,7 @@ async def main(room_url: str, token):
llm = AzureLLMService() llm = AzureLLMService()
tts = AzureTTSService() tts = AzureTTSService()
img = FalImageGenService(image_size="1024x1024") img = FalImageGenService(image_size="1024x1024", aiohttp_session=aiohttp_session)
async def get_images(): async def get_images():
get_speaking_task = asyncio.create_task( get_speaking_task = asyncio.create_task(
@@ -80,8 +79,8 @@ async def main(room_url: str, token):
messages, transport.my_participant_id messages, transport.my_participant_id
) )
image_sync_aggregator = ImageSyncAggregator( image_sync_aggregator = ImageSyncAggregator(
"/Users/moishe/src/daily-ai-sdk/src/samples/foundational/speaking.png", os.path.join(os.path.dirname(__file__), "images", "speaking.png"),
"/Users/moishe/src/daily-ai-sdk/src/samples/foundational/waiting.png", os.path.join(os.path.dirname(__file__), "images", "waiting.png"),
) )
await tts.run_to_queue( await tts.run_to_queue(
transport.send_queue, transport.send_queue,

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB