Commit ·
b442f06
1
Parent(s): d03daf4
Agrees to terms
Browse files- handler.py +10 -0
- tos_agreed.txt +1 -0
handler.py
CHANGED
|
@@ -2,6 +2,7 @@ import torch
|
|
| 2 |
import requests
|
| 3 |
import base64
|
| 4 |
import os
|
|
|
|
| 5 |
import datetime
|
| 6 |
from TTS.api import TTS
|
| 7 |
from typing import Dict, List, Any
|
|
@@ -10,6 +11,7 @@ available_speakers = ['Claribel Dervla', 'Daisy Studious', 'Gracie Wise', 'Tammi
|
|
| 10 |
|
| 11 |
class EndpointHandler:
|
| 12 |
def __init__(self, path=""):
|
|
|
|
| 13 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 14 |
self.tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
|
| 15 |
|
|
@@ -57,3 +59,11 @@ class EndpointHandler:
|
|
| 57 |
return f"Fehler: {e}"
|
| 58 |
|
| 59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import requests
|
| 3 |
import base64
|
| 4 |
import os
|
| 5 |
+
import shutil
|
| 6 |
import datetime
|
| 7 |
from TTS.api import TTS
|
| 8 |
from typing import Dict, List, Any
|
|
|
|
| 11 |
|
| 12 |
class EndpointHandler:
|
| 13 |
def __init__(self, path=""):
|
| 14 |
+
self.agree_tos()
|
| 15 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 16 |
self.tts = TTS("tts_models/multilingual/multi-dataset/xtts_v2").to(device)
|
| 17 |
|
|
|
|
| 59 |
return f"Fehler: {e}"
|
| 60 |
|
| 61 |
|
| 62 |
+
def agree_tos(self):
|
| 63 |
+
home_dir = os.path.expanduser('~')
|
| 64 |
+
target_folder = os.path.join(home_dir, '.local', 'share', 'tts', 'tts_models--multilingual--multi-dataset--xtts_v2')
|
| 65 |
+
if not os.path.exists(target_folder):
|
| 66 |
+
os.makedirs(target_folder)
|
| 67 |
+
source_file = 'tos_agreed.txt'
|
| 68 |
+
destination_file = os.path.join(target_folder, 'tos_agreed.txt')
|
| 69 |
+
shutil.copy(source_file, destination_file)
|
tos_agreed.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
I have read, understood and agreed to the Terms and Conditions.
|