nithinraok commited on
Commit
a0314cc
1 Parent(s): 59f339a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -14
app.py CHANGED
@@ -18,15 +18,6 @@ def run_diarization(path1):
18
  end_time = float(start_time) + float(duration)
19
  df.loc[idx] = start_time, end_time, speaker
20
  return df
21
-
22
- inputs = [
23
- gr.components.Audio(source="microphone", type="filepath", optional=True, label="Input Audio"),
24
- ]
25
- output = gr.components.Dataframe()
26
-
27
- description = (
28
- "This demonstration will perform offline speaker diarization on an audio file using nemo"
29
- )
30
 
31
  article = (
32
  "<p style='text-align: center'>"
@@ -40,12 +31,12 @@ examples = [
40
  ["data/id10270_5r0dWxy17C8-00001.wav"],
41
  ]
42
 
43
- interface = gr.Interface(
44
  fn=run_diarization,
45
- inputs=inputs,
46
- outputs=output,
47
  title="Offline Speaker Diarization with NeMo",
48
- description=description,
49
  article=article,
50
  layout="horizontal",
51
  theme="huggingface",
@@ -53,4 +44,21 @@ interface = gr.Interface(
53
  live=False,
54
  examples=examples,
55
  )
56
- interface.launch(enable_queue=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  end_time = float(start_time) + float(duration)
19
  df.loc[idx] = start_time, end_time, speaker
20
  return df
 
 
 
 
 
 
 
 
 
21
 
22
  article = (
23
  "<p style='text-align: center'>"
 
31
  ["data/id10270_5r0dWxy17C8-00001.wav"],
32
  ]
33
 
34
+ microphone_interface = gr.Interface(
35
  fn=run_diarization,
36
+ inputs=[gr.Audio(source="microphone", type="filepath", optional=True, label="Mic Audio")],
37
+ outputs=[gr.components.Dataframe()],
38
  title="Offline Speaker Diarization with NeMo",
39
+ description="This demonstration will perform offline speaker diarization on an audio file using nemo",
40
  article=article,
41
  layout="horizontal",
42
  theme="huggingface",
 
44
  live=False,
45
  examples=examples,
46
  )
47
+
48
+ upload_interface = gr.Interface(
49
+ fn=run_diarization,
50
+ inputs=[gr.Audio(source="upload", type='filepath',optional=True, label='Upload File')],
51
+ outputs=[gr.components.Dataframe()],
52
+ title="Offline Speaker Diarization with NeMo",
53
+ description="This demonstration will perform offline speaker diarization on an audio file using nemo",
54
+ article=article,
55
+ layout="horizontal",
56
+ theme="huggingface",
57
+ allow_flagging=False,
58
+ live=False,
59
+ examples=examples,
60
+ )
61
+
62
+ demo = gr.TabbedInterface([microphone_interface, upload_interface], ["Microphone", "Upload File"])
63
+
64
+ demo.launch(enable_queue=True)