dlaiu commited on
Commit
a2df844
·
1 Parent(s): a8122f8
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -1,4 +1,6 @@
1
  import gradio as gr
 
 
2
 
3
  # def greet(name):
4
  # return "Hello " + name + "!!"
@@ -6,14 +8,12 @@ import gradio as gr
6
  # demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
  # demo.launch()
8
 
9
- import parselmouth
10
 
11
  def get_pitch(audio_file):
12
  sound = parselmouth.Sound(audio_file)
13
- pitch = call(sound, "To Pitch", 0.0, 75, 500)
14
  pitch_values = pitch.selected_array['frequency']
15
- text = print(pitch_values)
16
- return text
17
 
18
  demo = gr.Interface(fn=get_pitch, inputs="audio", outputs="text")
19
  demo.launch()
 
1
  import gradio as gr
2
+ import parselmouth
3
+ from parselmouth.praat import call
4
 
5
  # def greet(name):
6
  # return "Hello " + name + "!!"
 
8
  # demo = gr.Interface(fn=greet, inputs="text", outputs="text")
9
  # demo.launch()
10
 
 
11
 
12
  def get_pitch(audio_file):
13
  sound = parselmouth.Sound(audio_file)
14
+ pitch = call(sound, "To Pitch", 0.0, 75, 500) # Make sure these settings are appropriate for your needs
15
  pitch_values = pitch.selected_array['frequency']
16
+ return "Pitch frequencies: " + str(pitch_values) # Printing is not suitable here, return the string instead
 
17
 
18
  demo = gr.Interface(fn=get_pitch, inputs="audio", outputs="text")
19
  demo.launch()