inigo99 commited on
Commit
bbafd24
·
1 Parent(s): 25b69af

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from huggingface_hub import from_pretrained_fastai
2
+ import gradio as gr
3
+ from fastai.text.all import *
4
+
5
+ learner = from_pretrained_fastai("soundWave.pth")
6
+ labels = learner.dls.vocab
7
+
8
+ # Definimos una función que se encarga de llevar a cabo las predicciones
9
+ def predict(waveform):
10
+ pred = learner.predict(waveform)
11
+ return {labels[i]}
12
+
13
+ # Creamos la interfaz y la lanzamos.
14
+ gr.Interface(fn=predict, inputs=gr.inputs.Audio(), outputs=gr.outputs.Label(num_top_classes=35)).launch(share=False)
15
+