nithinraok commited on
Commit
5773ebb
1 Parent(s): d68b1ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -15,7 +15,6 @@ speaker_model = EncDecSpeakerLabelModel.from_pretrained("nvidia/speakerverificat
15
  model.eval()
16
 
17
  def run_diarization(path1):
18
- print(path1)
19
  annotation = model(path1, num_workers=0, batch_size=16)
20
  rttm=annotation.to_rttm()
21
  df = pd.DataFrame(columns=['start_time', 'end_time', 'speaker', 'text'])
@@ -65,7 +64,7 @@ def get_transcripts(df, audio_path):
65
  filename = create_manifest(df,audio_path)
66
  model = EncDecRNNTBPEModel.from_pretrained(model_name="nvidia/stt_en_fastconformer_transducer_large").to(device)
67
  model.eval()
68
- config = OmegaConf.create({"manifest_filepath": filename, 'batch_size': 4})
69
  dataloader = model._setup_transcribe_dataloader(config)
70
 
71
  hypotheses = []
@@ -106,8 +105,9 @@ examples = [
106
 
107
  microphone_interface = gr.Interface(
108
  fn=run_diarization,
109
- inputs=[gr.Audio(source="microphone", type="filepath", optional=True, label="Mic Audio")],
110
- outputs=[gr.components.Dataframe()],
 
111
  title="Offline Speaker Diarization with NeMo",
112
  description="This demonstration will perform offline speaker diarization on an audio file using nemo",
113
  article=article,
@@ -116,12 +116,13 @@ microphone_interface = gr.Interface(
116
  allow_flagging=False,
117
  live=False,
118
  examples=examples,
119
- )
120
 
121
  upload_interface = gr.Interface(
122
  fn=run_diarization,
123
- inputs=[gr.Audio(source="upload", type='filepath',optional=True, label='Upload File')],
124
- outputs=[gr.components.Dataframe()],
 
125
  title="Offline Speaker Diarization with NeMo",
126
  description="This demonstration will perform offline speaker diarization on an audio file using nemo",
127
  article=article,
@@ -130,8 +131,8 @@ upload_interface = gr.Interface(
130
  allow_flagging=False,
131
  live=False,
132
  examples=examples,
133
- )
134
 
135
  demo = gr.TabbedInterface([microphone_interface, upload_interface], ["Microphone", "Upload File"])
136
 
137
- demo.launch(enable_queue=True)
 
15
  model.eval()
16
 
17
  def run_diarization(path1):
 
18
  annotation = model(path1, num_workers=0, batch_size=16)
19
  rttm=annotation.to_rttm()
20
  df = pd.DataFrame(columns=['start_time', 'end_time', 'speaker', 'text'])
 
64
  filename = create_manifest(df,audio_path)
65
  model = EncDecRNNTBPEModel.from_pretrained(model_name="nvidia/stt_en_fastconformer_transducer_large").to(device)
66
  model.eval()
67
+ config = OmegaConf.create({"manifest_filepath": filename, 'batch_size': 2})
68
  dataloader = model._setup_transcribe_dataloader(config)
69
 
70
  hypotheses = []
 
105
 
106
  microphone_interface = gr.Interface(
107
  fn=run_diarization,
108
+ inputs=[gr.Audio(source="microphone", type="filepath", label="Mic Audio")],
109
+ outputs=[gr.components.Dataframe(wrap=True, label='Speaker Diariazation with Speech Recognition',
110
+ row_count=(1, "dynamic"), headers=['start_time', 'end_time', 'speaker', 'text'])],
111
  title="Offline Speaker Diarization with NeMo",
112
  description="This demonstration will perform offline speaker diarization on an audio file using nemo",
113
  article=article,
 
116
  allow_flagging=False,
117
  live=False,
118
  examples=examples,
119
+ )
120
 
121
  upload_interface = gr.Interface(
122
  fn=run_diarization,
123
+ inputs=[gr.Audio(source="upload", type='filepath', label='Upload File')],
124
+ outputs=[gr.components.Dataframe(wrap=True, label='Speaker Diariazation with Speech Recognition',
125
+ row_count=(1, "dynamic"), headers=['start_time', 'end_time', 'speaker', 'text'])],
126
  title="Offline Speaker Diarization with NeMo",
127
  description="This demonstration will perform offline speaker diarization on an audio file using nemo",
128
  article=article,
 
131
  allow_flagging=False,
132
  live=False,
133
  examples=examples,
134
+ )
135
 
136
  demo = gr.TabbedInterface([microphone_interface, upload_interface], ["Microphone", "Upload File"])
137
 
138
+ demo.launch(enable_queue=True)