DanielDBGC
test
52008ae
raw
history blame
823 Bytes
import gradio as gr
import transformers
pipeline = pipeline("audio-classification", model="DanielDBGC/my_awesome_lang_class_mind_model")
def predict(input_sound):
dataset = load_dataset("PolyAI/minds14", name="en-US", split="train")
dataset = dataset.cast_column("audio", Audio(sampling_rate=16000))
sampling_rate = dataset.features["audio"].sampling_rate
audio_file = dataset[0]["audio"]["path"]
predictions = pipeline(audio_file)
return {p["label"]: p["score"] for p in predictions}
gradio_app = gr.Interface(
predict,
inputs= 'Test' #gr.Audio(label="Record or upload someone speaking!", sources=['upload', 'microphone'], type = 'numpy'),
outputs=#[gr.Label(label="Result", num_top_classes=3)],
title="Guess the language!",
)
if __name__ == "__main__":
gradio_app.launch()