Spaces:
Sleeping
Sleeping
import gradio as gr | |
import os | |
import torch | |
import whisper | |
voice_model = whisper.load_model("large-v2") | |
def transcribe_audio(audio_path): | |
result = voice_model.transcribe(whisper.pad_or_trim(whisper.load_audio(audio_path)))["text"] | |
os.remove(audio_path) | |
return {"text": result} | |
# Create a Gradio interface | |
input_audio = gr.Audio(type="filepath") | |
output_text = gr.outputs.Textbox() | |
iface = gr.Interface(fn=transcribe_audio, inputs=input_audio, outputs=output_text, title="Audio Transcription") | |
iface.launch(debug=True,share=True) |