salmanmapkar commited on
Commit
18759e9
1 Parent(s): 883359b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -7
app.py CHANGED
@@ -150,7 +150,7 @@ def Transcribe(NumberOfSpeakers, SpeakerNames="", audio="temp_audio.wav"):
150
 
151
  def Transcribe_V2(num_speakers, speaker_names, audio="temp_audio.wav"):
152
  SPEAKER_DICT = {}
153
- SPEAKERS = []
154
  def GetSpeaker(sp):
155
  speaker = sp
156
  if sp not in list(SPEAKER_DICT.keys()):
@@ -162,12 +162,7 @@ def Transcribe_V2(num_speakers, speaker_names, audio="temp_audio.wav"):
162
  speaker = SPEAKER_DICT[sp]
163
  return speaker
164
 
165
- def GenerateSpeakerDict(sp):
166
- global SPEAKERS
167
- SPEAKERS = [speaker.strip() for speaker in sp.split(',')]
168
-
169
  # audio = Audio()
170
- GenerateSpeakerDict(speaker_names)
171
  def get_output(segments):
172
  # print(segments)
173
  conversation=[]
@@ -184,7 +179,7 @@ def Transcribe_V2(num_speakers, speaker_names, audio="temp_audio.wav"):
184
  # conversation.append([GetSpeaker(segment["speaker"]), segment["text"][1:]]) # segment["speaker"] + ' ' + str(time(segment["start"])) + '\n\n'
185
  # conversation[-1][1] += segment["text"][1:]
186
  # return output
187
- return conversation, ("".join([f"{speaker} --> {text}\n" for speaker, text in conversation]))
188
 
189
  def get_duration(path):
190
  with contextlib.closing(wave.open(path,'r')) as f:
 
150
 
151
  def Transcribe_V2(num_speakers, speaker_names, audio="temp_audio.wav"):
152
  SPEAKER_DICT = {}
153
+ SPEAKERS = [speaker.strip() for speaker in sp.split(',')]
154
  def GetSpeaker(sp):
155
  speaker = sp
156
  if sp not in list(SPEAKER_DICT.keys()):
 
162
  speaker = SPEAKER_DICT[sp]
163
  return speaker
164
 
 
 
 
 
165
  # audio = Audio()
 
166
  def get_output(segments):
167
  # print(segments)
168
  conversation=[]
 
179
  # conversation.append([GetSpeaker(segment["speaker"]), segment["text"][1:]]) # segment["speaker"] + ' ' + str(time(segment["start"])) + '\n\n'
180
  # conversation[-1][1] += segment["text"][1:]
181
  # return output
182
+ return ("".join([f"{speaker} --> {text}\n" for speaker, text in conversation])), conversation
183
 
184
  def get_duration(path):
185
  with contextlib.closing(wave.open(path,'r')) as f: