google env fixes

This commit is contained in:
Ajay Raj 2023-03-29 01:54:26 -07:00
commit 11af47482c
4 changed files with 13 additions and 21 deletions

View file

@ -1,4 +1,5 @@
import asyncio
import os
import time
import queue
from google.cloud import speech
@ -19,10 +20,12 @@ class GoogleTranscriber(BaseTranscriber):
super().__init__(transcriber_config)
self._queue = queue.Queue()
self._ended = False
if not getenv("GOOGLE_APPLICATION_CREDENTIALS"):
credentials_path = getenv("GOOGLE_APPLICATION_CREDENTIALS")
if not credentials_path:
raise Exception(
"Please set GOOGLE_APPLICATION_CREDENTIALS environment variable"
)
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = credentials_path
self.google_streaming_config = self.create_google_streaming_config()
self.client = speech.SpeechClient()
self.warmed_up = False