fahadqazi commited on
Commit
8249b6c
·
verified ·
1 Parent(s): 0629797

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -10,14 +10,21 @@ from speechbrain.pretrained import EncoderClassifier
10
  from datasets import load_dataset
11
 
12
 
13
- from piper_tts import Piper
14
 
15
- # Initialize the Piper TTS engine
16
- tts = Piper()
 
 
 
 
 
 
 
 
17
 
18
 
19
 
20
- device = "cuda" if torch.cuda.is_available() else "cpu"
21
 
22
  def load_models_and_data():
23
  auth_token = os.environ.get("hf_token") or True
 
10
  from datasets import load_dataset
11
 
12
 
13
+ from piper_tts import PiperVoice
14
 
15
+
16
+ device = "cuda" if torch.cuda.is_available() else "cpu"
17
+
18
+
19
+ auth_token = os.environ.get("hf_token") or True
20
+
21
+ model_path = hf_hub_download(repo_id="fahadqazi/piper-sindhi", filename="model.onnx", use_auth_token=auth_token)
22
+
23
+
24
+ voice = PiperVoice.load(model_path=model_path, use_cuda=device=="cuda")
25
 
26
 
27
 
 
28
 
29
  def load_models_and_data():
30
  auth_token = os.environ.get("hf_token") or True