Skip to content

Commit

Permalink
default to openai for tts on dev env
Browse files Browse the repository at this point in the history
  • Loading branch information
nwaughachukwuma committed Dec 7, 2024
1 parent b4d37e6 commit 596ea23
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions api/src/env_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@

CSE_ID = environ["CSE_ID"]
CSE_API_KEY = environ["GOOGLE_API_KEY"]

PROD_ENV = environ.get("ENV", "dev") == "prod"
5 changes: 4 additions & 1 deletion api/src/utils/generate_audiocast.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from fastapi import BackgroundTasks, HTTPException

from src.env_var import PROD_ENV
from src.services.storage import StorageManager

from .audio_manager import AudioManager, AudioManagerConfig
Expand Down Expand Up @@ -122,7 +123,9 @@ def update_session_info(info: str):

# Generate audio
update_session_info("Generating audio...")
audio_manager = AudioManager(custom_config=AudioManagerConfig(tts_provider="elevenlabs"))

tts_provider = "elevenlabs" if PROD_ENV else "openai"
audio_manager = AudioManager(custom_config=AudioManagerConfig(tts_provider=tts_provider))
audio_path = await audio_manager.generate_speech(audio_script)

background_tasks.add_task(
Expand Down

0 comments on commit 596ea23

Please sign in to comment.