Spaces:
Runtime error
Runtime error
JackismyShephard
commited on
Commit
•
c1ce43e
1
Parent(s):
fb80a81
fix application file
Browse files
app.py
CHANGED
@@ -21,42 +21,27 @@ def classify_audio(filepath):
|
|
21 |
return outputs
|
22 |
|
23 |
|
24 |
-
|
25 |
demo = gr.Blocks()
|
26 |
|
27 |
file_classify = gr.Interface(
|
28 |
fn=classify_audio,
|
29 |
-
|
30 |
-
|
31 |
-
#TODO not sure we need '.inputs.'
|
32 |
-
gr.inputs.Audio(source="upload", optional=True, label="Audio file", type="filepath"),
|
33 |
-
#TODO add inputs source upload here, if possible?
|
34 |
-
#TODO add inputs source youtube here, if possible?
|
35 |
-
],
|
36 |
-
outputs="label", #TODO not sure about this
|
37 |
-
layout="horizontal", #TODO not sure we need this
|
38 |
-
theme="huggingface",
|
39 |
title="Classify Genre of Music",
|
40 |
description=(
|
41 |
"Classify long-form audio or microphone inputs with the click of a button! Demo uses the"
|
42 |
f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to classify audio files"
|
43 |
" of arbitrary length."
|
44 |
),
|
45 |
-
examples=
|
46 |
-
["./example.flac"],
|
47 |
-
],
|
48 |
cache_examples=True,
|
49 |
allow_flagging="never",
|
50 |
)
|
51 |
|
52 |
mic_classify = gr.Interface(
|
53 |
fn=classify_audio,
|
54 |
-
inputs=[
|
55 |
-
|
56 |
-
],
|
57 |
-
outputs="label", #TODO not sure about this
|
58 |
-
layout="horizontal",
|
59 |
-
theme="huggingface",
|
60 |
title="Classify Genre of Music",
|
61 |
description=(
|
62 |
"Classify long-form audio or microphone inputs with the click of a button! Demo uses the"
|
@@ -67,6 +52,6 @@ mic_classify = gr.Interface(
|
|
67 |
)
|
68 |
|
69 |
with demo:
|
70 |
-
gr.TabbedInterface([file_classify, mic_classify], ["Classify Audio File", "classify Microphone
|
71 |
|
72 |
-
demo.launch(
|
|
|
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 Genre of Music",
|
31 |
description=(
|
32 |
"Classify long-form audio or microphone inputs with the click of a button! Demo uses the"
|
33 |
f" checkpoint [{MODEL_NAME}](https://huggingface.co/{MODEL_NAME}) and 🤗 Transformers to classify audio files"
|
34 |
" of arbitrary length."
|
35 |
),
|
36 |
+
examples="./examples",
|
|
|
|
|
37 |
cache_examples=True,
|
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 Genre of Music",
|
46 |
description=(
|
47 |
"Classify long-form audio or microphone inputs with the click of a button! Demo uses the"
|
|
|
52 |
)
|
53 |
|
54 |
with demo:
|
55 |
+
gr.TabbedInterface([file_classify, mic_classify], ["Classify Audio File", "classify Microphone Input"])
|
56 |
|
57 |
+
demo.launch()
|