Spaces:
Sleeping
Sleeping
File size: 548 Bytes
ef910fd 522c171 ef910fd 85c8109 522c171 8e797fd 522c171 ef910fd 8e797fd ef910fd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import gradio as gr
import librosa
def load_audio_to_tensor(filename):
audio, sampling_rate = librosa.load(filename, sr=None, mono=True) # load audio and convert to mono
wave = librosa.resample(audio, orig_sr=sampling_rate, target_sr=16000) # resample to 16KHz
return wave
def greet(name):
load_audio_to_tensor(name)
# return "Hello " + str(name[1]) + "!!"
return name + 'type'
iface = gr.Interface(fn=greet, inputs="file", outputs="text")
# iface = gr.Interface(fn=greet, inputs="audio", outputs="text")
iface.launch() |