examples: move non-working examples to to_be_updated

This commit is contained in:
Aleix Conchillo Flaqué
2024-04-04 14:04:53 -07:00
parent 03ea208361
commit 982c0a0749
8 changed files with 32 additions and 60 deletions

View File

@@ -6,6 +6,9 @@ import os
from dailyai.services.elevenlabs_ai_service import ElevenLabsTTSService
from dailyai.transports.local_transport import LocalTransport
from dotenv import load_dotenv
load_dotenv(override=True)
logging.basicConfig(format=f"%(levelno)s %(asctime)s %(message)s")
logger = logging.getLogger("dailyai")
logger.setLevel(logging.DEBUG)
@@ -25,10 +28,7 @@ async def main():
async def say_something():
await asyncio.sleep(1)
await tts.say(
"Hello there.",
transport.send_queue,
)
await transport.say("Hello there.", tts)
await transport.stop_when_done()
await asyncio.gather(transport.run(), say_something())

View File

@@ -3,12 +3,10 @@ import logging
from dailyai.transports.daily_transport import DailyTransport
from dailyai.services.whisper_ai_services import WhisperSTTService
from dailyai.pipeline.pipeline import Pipeline
from runner import configure
from dotenv import load_dotenv
load_dotenv(override=True)
logging.basicConfig(format=f"%(levelno)s %(asctime)s %(message)s")
logger = logging.getLogger("dailyai")
logger.setLevel(logging.DEBUG)
@@ -19,27 +17,26 @@ async def main(room_url: str):
room_url,
None,
"Transcription bot",
start_transcription=True,
start_transcription=False,
mic_enabled=False,
camera_enabled=False,
speaker_enabled=True,
)
stt = WhisperSTTService()
transcription_output_queue = asyncio.Queue()
pipeline = Pipeline([stt])
pipeline.set_sink(transcription_output_queue)
async def handle_transcription():
print("`````````TRANSCRIPTION`````````")
while True:
item = await transcription_output_queue.get()
print(item.text)
async def handle_speaker():
await stt.run_to_queue(
transcription_output_queue, transport.get_receive_frames()
)
await asyncio.gather(transport.run(), handle_speaker(), handle_transcription())
await asyncio.gather(transport.run(pipeline), handle_transcription())
if __name__ == "__main__":

View File

@@ -1,32 +1,35 @@
import argparse
import asyncio
import logging
from dailyai.pipeline.frames import EndFrame, TranscriptionFrame
from dailyai.pipeline.frames import EndFrame, TranscriptionFrame
from dailyai.transports.local_transport import LocalTransport
from dailyai.services.whisper_ai_services import WhisperSTTService
from dailyai.pipeline.pipeline import Pipeline
logging.basicConfig(format=f"%(levelno)s %(asctime)s %(message)s")
logger = logging.getLogger("dailyai")
logger.setLevel(logging.DEBUG)
async def main(room_url: str):
global transport
global stt
async def main():
meeting_duration_minutes = 1
transport = LocalTransport(
mic_enabled=True,
mic_enabled=False,
camera_enabled=False,
speaker_enabled=True,
duration_minutes=meeting_duration_minutes,
start_transcription=True,
start_transcription=False,
)
stt = WhisperSTTService()
transcription_output_queue = asyncio.Queue()
transport_done = asyncio.Event()
pipeline = Pipeline([stt])
pipeline.set_sink(transcription_output_queue)
async def handle_transcription():
print("`````````TRANSCRIPTION`````````")
while not transport_done.is_set():
@@ -38,29 +41,13 @@ async def main(room_url: str):
break
print("handle_transcription done")
async def handle_speaker():
await stt.run_to_queue(
transcription_output_queue, transport.get_receive_frames()
)
await transcription_output_queue.put(EndFrame())
print("handle speaker done.")
async def run_until_done():
await transport.run()
await transport.run(pipeline)
transport_done.set()
print("run_until_done done")
await asyncio.gather(run_until_done(), handle_speaker(), handle_transcription())
await asyncio.gather(run_until_done(), handle_transcription())
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Simple Daily Bot Sample")
parser.add_argument(
"-u",
"--url",
type=str,
required=True,
help="URL of the Daily room to join")
args, unknown = parser.parse_known_args()
asyncio.run(main(args.url))
asyncio.run(main())

View File

@@ -1,5 +1,4 @@
import aiohttp
import argparse
import asyncio
import logging
import tkinter as tk
@@ -11,12 +10,15 @@ from dailyai.services.elevenlabs_ai_service import ElevenLabsTTSService
from dailyai.services.fal_ai_services import FalImageGenService
from dailyai.transports.local_transport import LocalTransport
from dotenv import load_dotenv
load_dotenv(override=True)
logging.basicConfig(format=f"%(levelno)s %(asctime)s %(message)s")
logger = logging.getLogger("dailyai")
logger.setLevel(logging.DEBUG)
async def main(room_url):
async def main():
async with aiohttp.ClientSession() as session:
meeting_duration_minutes = 5
tk_root = tk.Tk()
@@ -59,12 +61,8 @@ async def main(room_url):
return all_audio
async def get_month_data(month):
messages = [
{
"role": "system",
"content": f"Describe a nature photograph suitable for use in a calendar, for the month of {month}. Include only the image description with no preamble. Limit the description to one sentence, please.",
}
]
messages = [{"role": "system", "content": f"Describe a nature photograph suitable for use in a calendar, for the month of {
month}. Include only the image description with no preamble. Limit the description to one sentence, please.", }]
image_description = await llm.run_llm(messages)
if not image_description:
@@ -133,14 +131,4 @@ async def main(room_url):
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Simple Daily Bot Sample")
parser.add_argument(
"-u",
"--url",
type=str,
required=True,
help="URL of the Daily room to join")
args, unknown = parser.parse_known_args()
asyncio.run(main(args.url))
asyncio.run(main())