JackismyShephard commited on
Commit
e515109
1 Parent(s): 190820c

use single interface

Browse files
Files changed (1) hide show
  1. app.py +2 -21
app.py CHANGED
@@ -20,12 +20,9 @@ def classify_audio(filepath):
20
  outputs[p["label"]] = p["score"]
21
  return outputs
22
 
23
-
24
- demo = gr.Blocks()
25
-
26
- file_classify = gr.Interface(
27
  fn=classify_audio,
28
- inputs= gr.Audio(sources=["upload"], label="Audio file", type="filepath"),
29
  outputs=gr.Label(),
30
  title="Classify Genres of Music",
31
  description=(
@@ -38,20 +35,4 @@ file_classify = gr.Interface(
38
  allow_flagging="never",
39
  )
40
 
41
- mic_classify = gr.Interface(
42
- fn=classify_audio,
43
- inputs= gr.Audio(sources=["microphone"], type="filepath"),
44
- outputs= gr.Label(),
45
- title="Classify Genres of Music",
46
- description=(
47
- "Classify long-form audio or microphone inputs with the click of a button! Demo uses the"
48
- f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to classify audio files"
49
- " of arbitrary length."
50
- ),
51
- allow_flagging="never",
52
- )
53
-
54
- with demo:
55
- gr.TabbedInterface([file_classify, mic_classify], ["Classify Audio File", "Classify Microphone Input"])
56
-
57
  demo.launch()
 
20
  outputs[p["label"]] = p["score"]
21
  return outputs
22
 
23
+ demo = gr.Interface(
 
 
 
24
  fn=classify_audio,
25
+ inputs= gr.Audio(sources=["upload", "microphone"], label="Audio file", type="filepath"),
26
  outputs=gr.Label(),
27
  title="Classify Genres of Music",
28
  description=(
 
35
  allow_flagging="never",
36
  )
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  demo.launch()