Teapack1 commited on
Commit
5852718
1 Parent(s): 0cce770

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -3
app.py CHANGED
@@ -15,6 +15,7 @@ example_samples = [
15
  # Add more example samples as needed
16
  ]
17
 
 
18
 
19
  def classify_audio(audio):
20
  preds = pipe(audio)
@@ -24,13 +25,30 @@ def classify_audio(audio):
24
  return outputs
25
 
26
 
27
- iface = gr.Interface(
28
  fn=classify_audio,
29
  inputs=gr.inputs.Audio(source="microphone", type="filepath", label="Record your audio"),
30
  outputs=gr.outputs.Label(),
31
  title=title,
32
  description=description
33
  )
34
- iface.test_examples(example_samples)
35
 
36
- iface.launch(debug=True, share=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  # Add more example samples as needed
16
  ]
17
 
18
+ demo = gr.Blocks()
19
 
20
  def classify_audio(audio):
21
  preds = pipe(audio)
 
25
  return outputs
26
 
27
 
28
+ mic_classify = gr.Interface(
29
  fn=classify_audio,
30
  inputs=gr.inputs.Audio(source="microphone", type="filepath", label="Record your audio"),
31
  outputs=gr.outputs.Label(),
32
  title=title,
33
  description=description
34
  )
 
35
 
36
+ file_classify = gr.Interface(
37
+ fn=classify_audio,
38
+ title=title,
39
+ description=description,
40
+ inputs=gr.Audio(sources="upload", type="filepath"),
41
+ outputs=gr.outputs.Textbox(),
42
+ )
43
+
44
+ # iface.test_examples(example_samples)
45
+
46
+
47
+ with demo:
48
+ gr.TabbedInterface(
49
+ [mic_classify, file_classify],
50
+ ["Classify Microphone", "Classify Audio File"],
51
+ )
52
+
53
+
54
+ demo.launch(debug=True, share=True)