Fix 06a-image-sync.py
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
Reference in New Issue
Block a user