Fix the path to the token
Browse files- src/synthesize.py +5 -1
src/synthesize.py
CHANGED
|
@@ -11,6 +11,10 @@ import os
|
|
| 11 |
import numpy as np
|
| 12 |
from gradio_client import Client, handle_file
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
def synth_mms(text:str, model:str):
|
| 16 |
'''
|
|
@@ -29,7 +33,7 @@ def synth_mms(text:str, model:str):
|
|
| 29 |
# raw_response=True)._content
|
| 30 |
|
| 31 |
if model is not None:
|
| 32 |
-
pipe = pipeline("text-to-speech", model=model, device=-1,
|
| 33 |
) # Change device if it should use GPU
|
| 34 |
mms_tts = pipe(text)
|
| 35 |
return mms_tts['audio'], mms_tts['sampling_rate']
|
|
|
|
| 11 |
import numpy as np
|
| 12 |
from gradio_client import Client, handle_file
|
| 13 |
|
| 14 |
+
from dotenv import load_dotenv
|
| 15 |
+
# Load environment variables
|
| 16 |
+
load_dotenv()
|
| 17 |
+
|
| 18 |
|
| 19 |
def synth_mms(text:str, model:str):
|
| 20 |
'''
|
|
|
|
| 33 |
# raw_response=True)._content
|
| 34 |
|
| 35 |
if model is not None:
|
| 36 |
+
pipe = pipeline("text-to-speech", model=model, device=-1, token=os.environ['HUGGINGFACE_KEY']
|
| 37 |
) # Change device if it should use GPU
|
| 38 |
mms_tts = pipe(text)
|
| 39 |
return mms_tts['audio'], mms_tts['sampling_rate']
|