import gradio as gr | |
from transformers import pipeline | |
pipe = pipeline(task="text-classification", model="hoangthan/bert-vi-sms-classification") | |
def classify_audio(filepath): | |
preds = pipe(filepath) | |
outputs = {} | |
for p in preds: | |
outputs[p["label"]] = p["score"] | |
return outputs | |
gradio_app = gr.Interface( | |
fn=classify_audio, inputs=gr.Textbox(), outputs=gr.Label() | |
) | |
if __name__ == "__main__": | |
gradio_app.launch(debug=True) |