nithinraok commited on
Commit
feba9aa
1 Parent(s): 25f01f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -1,20 +1,20 @@
1
- # from nemo.collections.asr.models import NeuralDiarizer
2
  import gradio as gr
3
  import pandas as pd
4
 
5
  device = "cuda" if torch.cuda.is_available() else "cpu"
6
 
7
- # model = NeuralDiarizer.from_pretrained("diar_msdd_telephonic").to(device)
8
 
9
  def run_diarization(path1):
10
- # annotation = model(path1)
11
- # rttm=annotation.to_rttm()
12
  df = pd.DataFrame(columns=['start_time', 'end_time', 'speaker'])
13
- # for idx,line in enumerate(rttm.splitlines()):
14
- # split = line.split()
15
- # start_time, duration, speaker = split[3], split[4], split[7]
16
- # end_time = float(start_time) + float(duration)
17
- # df.loc[idx] = start_time, end_time, speaker
18
  return df
19
 
20
  inputs = [
 
1
+ from nemo.collections.asr.models import NeuralDiarizer
2
  import gradio as gr
3
  import pandas as pd
4
 
5
  device = "cuda" if torch.cuda.is_available() else "cpu"
6
 
7
+ model = NeuralDiarizer.from_pretrained("diar_msdd_telephonic").to(device)
8
 
9
  def run_diarization(path1):
10
+ annotation = model(path1)
11
+ rttm=annotation.to_rttm()
12
  df = pd.DataFrame(columns=['start_time', 'end_time', 'speaker'])
13
+ for idx,line in enumerate(rttm.splitlines()):
14
+ split = line.split()
15
+ start_time, duration, speaker = split[3], split[4], split[7]
16
+ end_time = float(start_time) + float(duration)
17
+ df.loc[idx] = start_time, end_time, speaker
18
  return df
19
 
20
  inputs = [