Spaces:
Build error
Build error
DanielDBGC
commited on
Commit
·
52008ae
1
Parent(s):
124b67b
test
Browse files
app.py
CHANGED
|
@@ -1,16 +1,20 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
|
| 3 |
|
| 4 |
pipeline = pipeline("audio-classification", model="DanielDBGC/my_awesome_lang_class_mind_model")
|
| 5 |
|
| 6 |
def predict(input_sound):
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
return {p["label"]: p["score"] for p in predictions}
|
| 9 |
|
| 10 |
gradio_app = gr.Interface(
|
| 11 |
predict,
|
| 12 |
-
inputs=gr.Audio(label="Record or upload someone speaking!", sources=['upload', 'microphone'], type = 'numpy'),
|
| 13 |
-
outputs
|
| 14 |
title="Guess the language!",
|
| 15 |
)
|
| 16 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import transformers
|
| 3 |
|
| 4 |
pipeline = pipeline("audio-classification", model="DanielDBGC/my_awesome_lang_class_mind_model")
|
| 5 |
|
| 6 |
def predict(input_sound):
|
| 7 |
+
dataset = load_dataset("PolyAI/minds14", name="en-US", split="train")
|
| 8 |
+
dataset = dataset.cast_column("audio", Audio(sampling_rate=16000))
|
| 9 |
+
sampling_rate = dataset.features["audio"].sampling_rate
|
| 10 |
+
audio_file = dataset[0]["audio"]["path"]
|
| 11 |
+
predictions = pipeline(audio_file)
|
| 12 |
return {p["label"]: p["score"] for p in predictions}
|
| 13 |
|
| 14 |
gradio_app = gr.Interface(
|
| 15 |
predict,
|
| 16 |
+
inputs= 'Test' #gr.Audio(label="Record or upload someone speaking!", sources=['upload', 'microphone'], type = 'numpy'),
|
| 17 |
+
outputs=#[gr.Label(label="Result", num_top_classes=3)],
|
| 18 |
title="Guess the language!",
|
| 19 |
)
|
| 20 |
|