HusseinBashir commited on
Commit
ae6a315
·
verified ·
1 Parent(s): 40ccb37

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -76,20 +76,19 @@ def normalize_text(text):
76
  return text
77
 
78
  def tts(text):
79
- text = normalize_text(text)
80
  inputs = tokenizer(text, return_tensors="pt").to(device)
81
  with torch.no_grad():
82
  waveform = model(**inputs).waveform.squeeze().cpu().numpy()
83
  filename = "output.wav"
84
  scipy.io.wavfile.write(filename, rate=model.config.sampling_rate, data=(waveform * 32767).astype(np.int16))
85
- return filename # ✅ waaba string path
86
 
87
 
88
 
89
  gr.Interface(
90
  fn=tts,
91
  inputs=gr.Textbox(label="Geli qoraal Soomaali ah"),
92
- outputs=gr.File(label="Soo dejiso codka"), # ✅ sax
93
  title="Somali TTS",
94
  description="Ku qor qoraal Soomaaliyeed si aad u maqasho cod dabiici ah.",
95
  allow_api=True
 
76
  return text
77
 
78
  def tts(text):
 
79
  inputs = tokenizer(text, return_tensors="pt").to(device)
80
  with torch.no_grad():
81
  waveform = model(**inputs).waveform.squeeze().cpu().numpy()
82
  filename = "output.wav"
83
  scipy.io.wavfile.write(filename, rate=model.config.sampling_rate, data=(waveform * 32767).astype(np.int16))
84
+ return filename # ✅ Audio file path
85
 
86
 
87
 
88
  gr.Interface(
89
  fn=tts,
90
  inputs=gr.Textbox(label="Geli qoraal Soomaali ah"),
91
+ outputs=gr.Audio(label="Codka TTS", type="filepath"), # ✅ not gr.File
92
  title="Somali TTS",
93
  description="Ku qor qoraal Soomaaliyeed si aad u maqasho cod dabiici ah.",
94
  allow_api=True