shamik-lseg commited on
Commit
bcf1972
·
1 Parent(s): 8c1d8e9

Updated the app.py.

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -9,13 +9,14 @@ title = """
9
  """
10
 
11
  description = """
12
- Next time you think of how **Shazam** <img src="./shazam.jpg" width=50px> finds the name of the song,
13
  well it might certainly be classifying the genre of the music too. This tool classifies music based
14
  on pre-defined genre from the [GTZAN](https://huggingface.co/datasets/marsyas/gtzan) dataset,
15
  which contains music from the following genres:
16
  `blues, classical, country, disco, hiphop, jazz, metal, pop, reggae, and rock`.
17
  """
18
 
 
19
  def classify_audio(filepath):
20
  audio, sampling_rate = librosa.load(filepath, sr=16_000)
21
  preds = pipe(audio)
@@ -27,10 +28,12 @@ def classify_audio(filepath):
27
 
28
  label = gr.Label()
29
 
30
- demo = gr.Interface(fn=classify_audio,
31
- inputs=gr.Audio(type="filepath"),
32
- outputs=label,
33
- title=title,
34
- description=description,
35
- examples=[["song1.ogg"], ["song2.ogg"], ["song3.ogg"], ["song4.ogg"]])
36
- demo.launch()
 
 
 
9
  """
10
 
11
  description = """
12
+ Next time you think of how **Shazam** <img src="https://huggingface.co/spaces/Shamik/music_genre_classifier/blob/main/shazam.jpg" width=50px> finds the name of the song,
13
  well it might certainly be classifying the genre of the music too. This tool classifies music based
14
  on pre-defined genre from the [GTZAN](https://huggingface.co/datasets/marsyas/gtzan) dataset,
15
  which contains music from the following genres:
16
  `blues, classical, country, disco, hiphop, jazz, metal, pop, reggae, and rock`.
17
  """
18
 
19
+
20
  def classify_audio(filepath):
21
  audio, sampling_rate = librosa.load(filepath, sr=16_000)
22
  preds = pipe(audio)
 
28
 
29
  label = gr.Label()
30
 
31
+ demo = gr.Interface(
32
+ fn=classify_audio,
33
+ inputs=gr.Audio(type="filepath"),
34
+ outputs=label,
35
+ title=title,
36
+ description=description,
37
+ examples=[["song1.ogg"], ["song2.ogg"], ["song3.ogg"], ["song4.ogg"]],
38
+ )
39
+ demo.launch()