Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ import gradio as gr
|
|
7 |
|
8 |
device = 0 if torch.cuda.is_available() else "cpu"
|
9 |
|
10 |
-
MODEL_ID = "jvalero/wav2vec2-base-
|
11 |
|
12 |
pipe = pipeline(
|
13 |
task="audio-classification",
|
@@ -16,7 +16,7 @@ pipe = pipeline(
|
|
16 |
device=device,
|
17 |
)
|
18 |
|
19 |
-
def
|
20 |
output = pipe(
|
21 |
filepath,
|
22 |
max_new_tokens=256,
|
@@ -33,16 +33,16 @@ demo = gr.Blocks()
|
|
33 |
demo = gr.Blocks()
|
34 |
|
35 |
file_transcribe = gr.Interface(
|
36 |
-
fn=
|
37 |
inputs=[
|
38 |
gr.Audio(sources="upload", label="Audio file", type="filepath"),
|
39 |
],
|
40 |
outputs="label",
|
41 |
title="Vinyl Condition Classificator",
|
42 |
description=(
|
43 |
-
"Get
|
44 |
f" checkpoint [{MODEL_ID}](https://huggingface.co/{MODEL_ID}) and 🤗 Transformers to get the condition of audio files"
|
45 |
-
" of arbitrary length."
|
46 |
),
|
47 |
examples=[
|
48 |
["./example.mp3"],
|
|
|
7 |
|
8 |
device = 0 if torch.cuda.is_available() else "cpu"
|
9 |
|
10 |
+
MODEL_ID = "jvalero/wav2vec2-base-music_genre_classifier"
|
11 |
|
12 |
pipe = pipeline(
|
13 |
task="audio-classification",
|
|
|
16 |
device=device,
|
17 |
)
|
18 |
|
19 |
+
def get_edm(filepath):
|
20 |
output = pipe(
|
21 |
filepath,
|
22 |
max_new_tokens=256,
|
|
|
33 |
demo = gr.Blocks()
|
34 |
|
35 |
file_transcribe = gr.Interface(
|
36 |
+
fn=get_edm,
|
37 |
inputs=[
|
38 |
gr.Audio(sources="upload", label="Audio file", type="filepath"),
|
39 |
],
|
40 |
outputs="label",
|
41 |
title="Vinyl Condition Classificator",
|
42 |
description=(
|
43 |
+
"Get the genre of your song! Demo uses the"
|
44 |
f" checkpoint [{MODEL_ID}](https://huggingface.co/{MODEL_ID}) and 🤗 Transformers to get the condition of audio files"
|
45 |
+
" of arbitrary length. \nThe audio will be classified into one of the following: ['drumbass', 'dubtechno', 'dupstep', 'hardcore_breaks', 'house', 'psytrance', 'techno', 'ukgarage']"
|
46 |
),
|
47 |
examples=[
|
48 |
["./example.mp3"],
|