thewh1teagle commited on
Commit
446d164
1 Parent(s): d55c8a9

update app

Browse files
Files changed (1) hide show
  1. app.py +2 -9
app.py CHANGED
@@ -13,8 +13,6 @@ from israwave import IsraWave
13
  from nakdimon_ort import Nakdimon
14
  from israwave.segment import SegmentExtractor
15
  import numpy as np
16
- import soundfile as sf
17
- import io
18
 
19
  segment_extractor = SegmentExtractor()
20
  speech_model = IsraWave('israwave.onnx', 'espeak-ng-data')
@@ -31,13 +29,8 @@ def create_audio(text: str, rate, pitch, energy):
31
  return np.concatenate(waveforms), speech_model.sample_rate
32
 
33
  def create(text, rate, pitch, energy):
34
- audio, sample_rate = create_audio(text, rate, pitch, energy)
35
-
36
- # Convert numpy array to WAV format in memory using soundfile
37
- with io.BytesIO() as buf:
38
- sf.write(buf, audio, sample_rate, format='WAV')
39
- buf.seek(0)
40
- return buf.read()
41
 
42
 
43
  with gr.Blocks(theme=gr.themes.Soft()) as demo:
 
13
  from nakdimon_ort import Nakdimon
14
  from israwave.segment import SegmentExtractor
15
  import numpy as np
 
 
16
 
17
  segment_extractor = SegmentExtractor()
18
  speech_model = IsraWave('israwave.onnx', 'espeak-ng-data')
 
29
  return np.concatenate(waveforms), speech_model.sample_rate
30
 
31
  def create(text, rate, pitch, energy):
32
+ samples, sample_rate = create_audio(text, rate, pitch, energy)
33
+ return (sample_rate, samples)
 
 
 
 
 
34
 
35
 
36
  with gr.Blocks(theme=gr.themes.Soft()) as demo: