herwoww commited on
Commit
006edc3
1 Parent(s): ea38bcc
Files changed (2) hide show
  1. app.py +5 -0
  2. requirements.txt +2 -1
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import os
2
  import torch
3
  import gradio as gr
 
4
  import os.path as op
5
  import pyarabic.araby as araby
6
 
@@ -18,6 +19,8 @@ checkpoint['cfg']['task'].t5_task = 't2s'
18
  checkpoint['cfg']['task'].hubert_label_dir = "utils/"
19
  checkpoint['cfg']['task'].bpe_tokenizer = "utils/arabic.model"
20
  checkpoint['cfg']['task'].data = "utils/"
 
 
21
  task = ArTSTTask.setup_task(checkpoint['cfg']['task'])
22
 
23
  emb_path='embs/clartts.npy'
@@ -43,6 +46,8 @@ def process_text(text):
43
  net_input = {}
44
 
45
  def inference(text, spkr=emb_path):
 
 
46
  net_input['src_tokens'] = process_text(text)
47
  net_input['spkembs'] = get_embs(spkr)
48
  outs, _, attn = task.generate_speech(
 
1
  import os
2
  import torch
3
  import gradio as gr
4
+ import numpy as np
5
  import os.path as op
6
  import pyarabic.araby as araby
7
 
 
19
  checkpoint['cfg']['task'].hubert_label_dir = "utils/"
20
  checkpoint['cfg']['task'].bpe_tokenizer = "utils/arabic.model"
21
  checkpoint['cfg']['task'].data = "utils/"
22
+ checkpoint['cfg']['model'].mask_prob = 0.0
23
+ checkpoint['cfg']['task'].mask_prob = 0.0
24
  task = ArTSTTask.setup_task(checkpoint['cfg']['task'])
25
 
26
  emb_path='embs/clartts.npy'
 
46
  net_input = {}
47
 
48
  def inference(text, spkr=emb_path):
49
+ if len(text.strip()) == 0:
50
+ return (16000, np.zeros(0).astype(np.int16))
51
  net_input['src_tokens'] = process_text(text)
52
  net_input['spkembs'] = get_embs(spkr)
53
  outs, _, attn = task.generate_speech(
requirements.txt CHANGED
@@ -30,4 +30,5 @@ nvidia-nccl-cu11==2.14.3
30
  nvidia-nvtx-cu11==11.7.91
31
  tensorboardx==2.6
32
  transformers
33
- speechbrain
 
 
30
  nvidia-nvtx-cu11==11.7.91
31
  tensorboardx==2.6
32
  transformers
33
+ speechbrain
34
+ numpy==1.23.5