dlaiu
try again with numpy
ea19a0e
raw
history blame
674 Bytes
import gradio as gr
import parselmouth
from parselmouth.praat import call
import numpy as np
# def greet(name):
# return "Hello " + name + "!!"
# demo = gr.Interface(fn=greet, inputs="text", outputs="text")
# demo.launch()
def get_pitch(audio_data):
rate, data = audio_data # Assuming Gradio passes (sampling_rate, numpy_array)
sound = parselmouth.Sound(values=np.array(data, dtype='float64'), sampling_frequency=rate)
pitch = call(sound, "To Pitch", 0.0, 75, 500)
pitch_values = pitch.selected_array['frequency']
return "Pitch frequencies: " + str(pitch_values)
demo = gr.Interface(fn=get_pitch, inputs="audio", outputs="text")
demo.launch()