arham061's picture
Update app.py
4e424e1
raw
history blame
No virus
556 Bytes
import gradio as gr
import torch
from transformers import pipeline
# Load the model from Hugging Face space
model = pipeline(task="audio-classification", model="model.safetensors")
def classify_audio(audio_file):
# Perform inference using the Hugging Face model
result = model(audio_file.read())
return result[0]["label"]
# Gradio Interface
iface = gr.Interface(
fn=classify_audio,
inputs=gr.Audio(type="file", label="Upload or Record Audio"),
outputs=gr.Textbox(),
live=True,
)
# Launch the Gradio interface
iface.launch()