Skip to content

Commit

Permalink
Merge pull request #21 from daily-co/cleanup_constructor_args
Browse files Browse the repository at this point in the history
Cleanup constructor args in examples
  • Loading branch information
Moishe authored Feb 8, 2024
2 parents 4ce36f8 + 3fa00c4 commit 5b8198c
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 53 deletions.
2 changes: 1 addition & 1 deletion src/samples/foundational/01-say-one-thing.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ async def main(room_url):
None,
"Say One Thing",
meeting_duration_minutes,
mic_enabled=True
)
transport._mic_enabled = True
tts = ElevenLabsTTSService(aiohttp_session=session, api_key=os.getenv("ELEVENLABS_API_KEY"), voice_id=os.getenv("ELEVENLABS_VOICE_ID"))

# Register an event handler so we can play the audio when the participant joins.
Expand Down
3 changes: 1 addition & 2 deletions src/samples/foundational/02-llm-say-one-thing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import argparse
import asyncio
import os

Expand All @@ -20,8 +19,8 @@ async def main(room_url):
None,
"Say One Thing From an LLM",
duration_minutes=meeting_duration_minutes,
mic_enabled=True
)
transport._mic_enabled = True

tts = ElevenLabsTTSService(aiohttp_session=session, api_key=os.getenv("ELEVENLABS_API_KEY"), voice_id=os.getenv("ELEVENLABS_VOICE_ID"))
# tts = AzureTTSService(api_key=os.getenv("AZURE_SPEECH_API_KEY"), region=os.getenv("AZURE_SPEECH_REGION"))
Expand Down
9 changes: 4 additions & 5 deletions src/samples/foundational/03-still-frame.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import argparse
import asyncio
import aiohttp
import os
Expand All @@ -23,11 +22,11 @@ async def main(room_url):
None,
"Show a still frame image",
duration_minutes=meeting_duration_minutes,
mic_enabled=False,
camera_enabled=True,
camera_width=1024,
camera_height=1024
)
transport._mic_enabled = False
transport._camera_enabled = True
transport._camera_width = 1024
transport._camera_height = 1024

imagegen = FalImageGenService(image_size="1024x1024", aiohttp_session=session, key_id=os.getenv("FAL_KEY_ID"), key_secret=os.getenv("FAL_KEY_SECRET"))
# imagegen = OpenAIImageGenService(aiohttp_session=session, api_key=os.getenv("OPENAI_DALLE_API_KEY"), image_size="1024x1024")
Expand Down
8 changes: 3 additions & 5 deletions src/samples/foundational/04-utterance-and-speech.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import argparse
import asyncio
import os
import re

import aiohttp

Expand All @@ -19,10 +17,10 @@ async def main(room_url: str):
None,
"Static And Dynamic Speech",
duration_minutes=1,
mic_enabled=True,
mic_sample_rate=16000,
camera_enabled=False
)
transport._mic_enabled = True
transport._mic_sample_rate = 16000
transport._camera_enabled = False

llm = AzureLLMService(api_key=os.getenv("AZURE_CHATGPT_API_KEY"), endpoint=os.getenv("AZURE_CHATGPT_ENDPOINT"), model=os.getenv("AZURE_CHATGPT_MODEL"))
azure_tts = AzureTTSService(api_key=os.getenv("AZURE_SPEECH_API_KEY"), region=os.getenv("AZURE_SPEECH_REGION"))
Expand Down
11 changes: 5 additions & 6 deletions src/samples/foundational/05-sync-speech-and-image.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import argparse
import asyncio
import aiohttp
import os
Expand All @@ -20,12 +19,12 @@ async def main(room_url):
None,
"Month Narration Bot",
duration_minutes=meeting_duration_minutes,
mic_enabled=True,
camera_enabled=True,
mic_sample_rate=16000,
camera_width=1024,
camera_height=1024
)
transport._mic_enabled = True
transport._camera_enabled = True
transport._mic_sample_rate = 16000
transport._camera_width = 1024
transport._camera_height = 1024

llm = AzureLLMService(api_key=os.getenv("AZURE_CHATGPT_API_KEY"), endpoint=os.getenv("AZURE_CHATGPT_ENDPOINT"), model=os.getenv("AZURE_CHATGPT_MODEL"))
tts = ElevenLabsTTSService(aiohttp_session=session, api_key=os.getenv("ELEVENLABS_API_KEY"), voice_id="ErXwobaYiN019PkySvjV")
Expand Down
4 changes: 0 additions & 4 deletions src/samples/foundational/06-listen-and-respond.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
from samples.foundational.support.runner import configure

async def main(room_url: str, token):
global transport
global llm
global tts

transport = DailyTransportService(
room_url,
token,
Expand Down
16 changes: 6 additions & 10 deletions src/samples/foundational/08-bots-arguing.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,17 @@

async def main(room_url:str):
async with aiohttp.ClientSession() as session:
global transport
global llm
global tts

transport = DailyTransportService(
room_url,
None,
"Respond bot",
duration_minutes=10
duration_minutes=10,
mic_enabled=True,
mic_sample_rate=16000,
camera_enabled=True,
camera_width=1024,
camera_height=1024
)
transport._mic_enabled = True
transport._mic_sample_rate = 16000
transport._camera_enabled = True
transport._camera_width = 1024
transport._camera_height = 1024

llm = AzureLLMService(api_key=os.getenv("AZURE_CHATGPT_API_KEY"), endpoint=os.getenv("AZURE_CHATGPT_ENDPOINT"), model=os.getenv("AZURE_CHATGPT_MODEL"))
tts1 = AzureTTSService(api_key=os.getenv("AZURE_SPEECH_API_KEY"), region=os.getenv("AZURE_SPEECH_REGION"))
Expand Down
11 changes: 6 additions & 5 deletions src/samples/foundational/10-wake-word.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,17 @@ async def process_frame(self, frame: QueueFrame) -> AsyncGenerator[QueueFrame, N

async def main(room_url: str, token):
async with aiohttp.ClientSession() as session:
global transport
global llm
global tts

transport = DailyTransportService(
room_url,
token,
"Santa Cat",
duration_minutes=3,
start_transcription=True
start_transcription=True,
mic_enabled=True,
mic_sample_rate=16000,
camera_enabled=True,
camera_width=720,
camera_height=1280
)
transport._mic_enabled = True
transport._mic_sample_rate = 16000
Expand Down
11 changes: 3 additions & 8 deletions src/samples/foundational/11-sound-effects.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,15 @@ async def process_frame(self, frame: QueueFrame) -> AsyncGenerator[QueueFrame, N

async def main(room_url: str, token):
async with aiohttp.ClientSession() as session:

global transport
global llm
global tts

transport = DailyTransportService(
room_url,
token,
"Respond bot",
duration_minutes=5,
mic_enabled=True,
mic_sample_rate=16000,
camera_enabled=False
)
transport._mic_enabled = True
transport._mic_sample_rate = 16000
transport._camera_enabled = False

llm = AzureLLMService(api_key=os.getenv("AZURE_CHATGPT_API_KEY"), endpoint=os.getenv("AZURE_CHATGPT_ENDPOINT"), model=os.getenv("AZURE_CHATGPT_MODEL"))
tts = ElevenLabsTTSService(aiohttp_session=session, api_key=os.getenv("ELEVENLABS_API_KEY"), voice_id="ErXwobaYiN019PkySvjV")
Expand Down
12 changes: 5 additions & 7 deletions src/samples/foundational/13-whisper-transcription.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@
from samples.foundational.support.runner import configure

async def main(room_url: str):
global transport
global stt

transport = DailyTransportService(
room_url,
None,
"Transcription bot",
start_transcription=True
start_transcription=True,
mic_enabled=False,
camera_enabled=False,
speaker_enabled=True
)
transport._mic_enabled = False
transport._camera_enabled = False
transport._speaker_enabled = True

stt = WhisperSTTService()
transcription_output_queue = asyncio.Queue()

Expand Down

0 comments on commit 5b8198c

Please sign in to comment.