audio_sentiment / app.py
Mark0047's picture
Update app.py
449f254 verified
raw
history blame contribute delete
669 Bytes
# import gradio as gr
# from transformers import pipeline
# # Load the model
# pipe = pipeline("audio-classification", model="superb/wav2vec2-base-superb-er")
# def classify_emotion(audio):
# result = pipe(audio, top_k=5)
# return result
# # Gradio interface for uploading an audio file
# gr.Interface(fn=classify_emotion, inputs=gr.Audio(sources=['upload', 'microphone'], type="filepath"), outputs="text").launch()
import gradio as gr
whisper = gr.load("models/superb/wav2vec2-base-superb-er")
def transcribe(audio):
return whisper(audio)
gr.Interface(transcribe, gr.Audio(sources=['upload', 'microphone'], type="filepath"), gr.Textbox()).launch()