msaelices commited on
Commit
b073205
β€’
1 Parent(s): 4a59798

Remove support for GoogleCloud, which was not working yet actually. WhisperX is way better IMO

Browse files
Files changed (3) hide show
  1. app.py +5 -10
  2. engines.py +0 -28
  3. requirements.txt +0 -1
app.py CHANGED
@@ -21,7 +21,7 @@ def main():
21
  title = 'πŸŽ™οΈ Meetings Note Taker πŸŽ™οΈ'
22
  st.title(title)
23
  st.write(
24
- 'Upload an audio file, transcribe it using WhisperX, GoogleCloud or Assembly.AI, and generate meeting notes using your selected model.'
25
  )
26
 
27
  openai_api_key = os.environ.get('OPENAI_API_KEY') or st.text_input(
@@ -29,16 +29,11 @@ def main():
29
  )
30
 
31
  engine_type = os.environ.get('TRANSCRIPTION_ENGINE') or st.selectbox(
32
- 'Select a transcription engine:', ['WhisperX', 'AssemblyAI', 'Google']
33
  )
34
- if engine_type in ['AssemblyAI', 'WhisperX']:
35
- engine_api_key = os.environ.get(
36
- f'{engine_type.upper()}_API_KEY'
37
- ) or st.text_input(f'Enter your {engine_type} API key:', type='password')
38
- else:
39
- engine_api_key = (
40
- None # Google doesn't need an API key but uses a credentials file
41
- )
42
  openai_model = os.environ.get('OPENAI_MODEL') or st.selectbox(
43
  'Select a model:', ['gpt-3.5-turbo-16k', 'gpt-4-0613']
44
  )
 
21
  title = 'πŸŽ™οΈ Meetings Note Taker πŸŽ™οΈ'
22
  st.title(title)
23
  st.write(
24
+ 'Upload an audio file, transcribe it using WhisperX or AssemblyAI, and generate meeting notes using your selected model.'
25
  )
26
 
27
  openai_api_key = os.environ.get('OPENAI_API_KEY') or st.text_input(
 
29
  )
30
 
31
  engine_type = os.environ.get('TRANSCRIPTION_ENGINE') or st.selectbox(
32
+ 'Select a transcription engine:', ['WhisperX', 'AssemblyAI']
33
  )
34
+ engine_api_key = os.environ.get(
35
+ f'{engine_type.upper()}_API_KEY'
36
+ ) or st.text_input(f'Enter your {engine_type} API key:', type='password')
 
 
 
 
 
37
  openai_model = os.environ.get('OPENAI_MODEL') or st.selectbox(
38
  'Select a model:', ['gpt-3.5-turbo-16k', 'gpt-4-0613']
39
  )
engines.py CHANGED
@@ -7,8 +7,6 @@ import requests
7
  import torch
8
  import whisperx
9
 
10
- from google.cloud import speech_v2 as speech
11
-
12
 
13
  class TranscriptEngine(Protocol):
14
  """Protocol for a transcription engine"""
@@ -58,31 +56,6 @@ class AssemblyAI:
58
  )
59
 
60
 
61
- class GoogleCloud:
62
- def __init__(self, api_key: str):
63
- pass # do not need an API key for Google Cloud
64
-
65
- def transcribe(self, language, audio_file: BytesIO) -> str:
66
- client = speech.SpeechClient()
67
-
68
- audio = speech.RecognitionAudio(content=audio_file.read())
69
-
70
- config = speech.RecognitionConfig(
71
- encoding=speech.RecognitionConfig.AudioEncoding.ENCODING_UNSPECIFIED,
72
- language_code=language,
73
- diarization_config=speech.SpeakerDiarizationConfig(
74
- enable_speaker_diarization=True,
75
- ),
76
- )
77
-
78
- operation = client.long_running_recognize(config=config, audio=audio)
79
- response = operation.result()
80
-
81
- return ' '.join(
82
- result.alternatives[0].transcript for result in response.results
83
- )
84
-
85
-
86
  class WhisperX:
87
  def __init__(self, api_key: str, device: str = 'cuda', compute_type: str = 'int8', batch_size: int = 8):
88
  self.api_key = api_key # HuggingFace API key
@@ -129,7 +102,6 @@ class WhisperX:
129
  def get_engine(engine_type: str, api_key: str | None) -> TranscriptEngine:
130
  engine_cls = {
131
  'AssemblyAI': AssemblyAI,
132
- 'Google': GoogleCloud,
133
  'WhisperX': WhisperX,
134
  }[engine_type]
135
 
 
7
  import torch
8
  import whisperx
9
 
 
 
10
 
11
  class TranscriptEngine(Protocol):
12
  """Protocol for a transcription engine"""
 
56
  )
57
 
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  class WhisperX:
60
  def __init__(self, api_key: str, device: str = 'cuda', compute_type: str = 'int8', batch_size: int = 8):
61
  self.api_key = api_key # HuggingFace API key
 
102
  def get_engine(engine_type: str, api_key: str | None) -> TranscriptEngine:
103
  engine_cls = {
104
  'AssemblyAI': AssemblyAI,
 
105
  'WhisperX': WhisperX,
106
  }[engine_type]
107
 
requirements.txt CHANGED
@@ -1,7 +1,6 @@
1
  requests>=2.31.0
2
  streamlit>=1.25.0
3
  python-dotenv>=1.0.0
4
- google_cloud_speech>=2.21.0
5
  torch==2.0.0
6
  torchvision==0.15.1
7
  torchaudio==2.0.1
 
1
  requests>=2.31.0
2
  streamlit>=1.25.0
3
  python-dotenv>=1.0.0
 
4
  torch==2.0.0
5
  torchvision==0.15.1
6
  torchaudio==2.0.1