SamSwift commited on
Commit
5484ec0
·
1 Parent(s): 5f8511a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -1,16 +1,13 @@
1
  import gradio as gr
2
  from inference import *
3
  from script import *
4
- import librosa
5
  import soundfile as sf
6
 
7
 
8
  def preprocess_audio(audio_array):
9
  try:
10
- #_, array = audio_array
11
- #sf.write('audio.wav', array, samplerate=48000, subtype='PCM_16')
12
- y, sr = librosa.load(audio_array, sr=48000)
13
- sf.write('audio.wav', y, samplerate=48000, subtype='PCM_16')
14
  return 'audio.wav'
15
  except TypeError as e:
16
  pass
@@ -41,7 +38,7 @@ def interface(Language, Audio_Inp):
41
  demo = gr.Interface(
42
  fn=interface,
43
  inputs=[gr.Dropdown(['Hausa', 'English', 'Yoruba'],
44
- value = 'Hausa', label='Select Your Prefered Language'), gr.Audio(source ='microphone', type='filepath')],
45
  outputs="text",
46
  live=True
47
  )
 
1
  import gradio as gr
2
  from inference import *
3
  from script import *
 
4
  import soundfile as sf
5
 
6
 
7
  def preprocess_audio(audio_array):
8
  try:
9
+ _, array = audio_array
10
+ sf.write('audio.wav', array, samplerate=48000, subtype='PCM_16')
 
 
11
  return 'audio.wav'
12
  except TypeError as e:
13
  pass
 
38
  demo = gr.Interface(
39
  fn=interface,
40
  inputs=[gr.Dropdown(['Hausa', 'English', 'Yoruba'],
41
+ value = 'Hausa', label='Select Your Prefered Language'), gr.Audio(source ='microphone', type='numpy')],
42
  outputs="text",
43
  live=True
44
  )