Spaces:
Sleeping
Sleeping
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() |