Spaces:
Sleeping
Sleeping
DurreSudoku
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
import gradio as gr
|
2 |
import keras
|
3 |
import librosa
|
4 |
-
import hopsworks
|
5 |
import os
|
6 |
import numpy as np
|
7 |
import shutil
|
8 |
from functions import log_mel_spectrogram, split_spectrogram, load_audio_file, image_transformer, save_spectrogram_as_png
|
9 |
from datasets import load_dataset
|
10 |
|
11 |
-
def
|
12 |
-
return
|
13 |
|
14 |
def create_image_folder(folder):
|
15 |
try:
|
@@ -110,17 +110,30 @@ with gr.Blocks() as demo:
|
|
110 |
|
111 |
The model has been trained to predict 8 top-level genres, that each encompasses a multitude of sub-genres.
|
112 |
|
113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
"""
|
115 |
)
|
116 |
with gr.Row():
|
117 |
with gr.Column():
|
118 |
audio = gr.Audio(sources="upload", type="filepath", label="Upload your song here", format="wav")
|
119 |
with gr.Column():
|
120 |
-
|
|
|
|
|
|
|
121 |
with gr.Row():
|
122 |
submit_audio = gr.Button(value="Submit audio for prediction")
|
123 |
-
submit_audio.click(fn=empty_string, outputs=answer_box)
|
124 |
submit_audio.click(fn=predict, inputs=audio, outputs=answer_box, trigger_mode="once")
|
125 |
submit_audio.click(fn=delete_folder)
|
126 |
|
|
|
1 |
import gradio as gr
|
2 |
import keras
|
3 |
import librosa
|
4 |
+
#import hopsworks
|
5 |
import os
|
6 |
import numpy as np
|
7 |
import shutil
|
8 |
from functions import log_mel_spectrogram, split_spectrogram, load_audio_file, image_transformer, save_spectrogram_as_png
|
9 |
from datasets import load_dataset
|
10 |
|
11 |
+
def return_input(input):
|
12 |
+
return input
|
13 |
|
14 |
def create_image_folder(folder):
|
15 |
try:
|
|
|
110 |
|
111 |
The model has been trained to predict 8 top-level genres, that each encompasses a multitude of sub-genres.
|
112 |
|
113 |
+
The top-level genres are:
|
114 |
+
|
115 |
+
1. Electronic
|
116 |
+
2. Experimental
|
117 |
+
3. Folk
|
118 |
+
4. Hip-Hop
|
119 |
+
5. Intrumental
|
120 |
+
6. International
|
121 |
+
7. Pop
|
122 |
+
8. Rock
|
123 |
+
|
124 |
+
Upload your favorite song or choose one of the example tracks and give it a try!
|
125 |
"""
|
126 |
)
|
127 |
with gr.Row():
|
128 |
with gr.Column():
|
129 |
audio = gr.Audio(sources="upload", type="filepath", label="Upload your song here", format="wav")
|
130 |
with gr.Column():
|
131 |
+
files = gr.FileExplorer(label="Example songs", file_count="single", root="examples", interactive=True)
|
132 |
+
files.change(fn=return_input, inputs=files, outputs=audio)
|
133 |
+
with gr.Row():
|
134 |
+
answer_box = gr.Text(label="Answer appears here", interactive=False)
|
135 |
with gr.Row():
|
136 |
submit_audio = gr.Button(value="Submit audio for prediction")
|
|
|
137 |
submit_audio.click(fn=predict, inputs=audio, outputs=answer_box, trigger_mode="once")
|
138 |
submit_audio.click(fn=delete_folder)
|
139 |
|