Spaces:
Build error
Build error
File size: 961 Bytes
5b5d4af |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
import os
import numpy as np
#try:
# import tensorflow # required in Colab to avoid protobuf compatibility issues
#except ImportError:
# pass
#import torch
#import pandas as pd
import whisper
#import torchaudio
#from tqdm.notebook import tqdm
#DEVICE = "cuda" if torch.cuda.is_available() else "CPU"
model = whisper.load_model("base.en")
def fun(audio):
result = model.transcribe(audio)
return result["text"]
# predict without timestamps for short-form transcription
#options = whisper.DecodingOptions(language="en", without_timestamps=True)
#for mels, texts in tqdm(loader):
# results = model.decode(mels, options)
# hypotheses.extend([result.text for result in results])
# references.extend(texts)
gr.Interface(
title = 'Testing Whisper',
fn=fun,
inputs=[
gr.inputs.Audio(source="microphone", streaming = "True" ) #,type="filepath")
],
outputs=[
"textbox"
],
live=True).launch()
|