Spaces:
Sleeping
Sleeping
IliaLarchenko
commited on
Commit
•
43d5e00
1
Parent(s):
2b819fe
OAI url fix
Browse files- api/audio.py +2 -2
api/audio.py
CHANGED
@@ -102,7 +102,7 @@ class TTSManager:
|
|
102 |
try:
|
103 |
if self.config.tts.type == "OPENAI_API":
|
104 |
data = {"model": self.config.tts.name, "input": text, "voice": "alloy", "response_format": "opus"}
|
105 |
-
response = requests.post(self.config.tts.url, headers=headers, json=data)
|
106 |
elif self.config.tts.type == "HF_API":
|
107 |
response = requests.post(self.config.tts.url, headers=headers, json={"inputs": text})
|
108 |
if response.status_code != 200:
|
@@ -122,7 +122,7 @@ class TTSManager:
|
|
122 |
data = {"model": self.config.tts.name, "input": text, "voice": "alloy", "response_format": "opus"}
|
123 |
|
124 |
try:
|
125 |
-
with requests.post(self.config.tts.url, headers=headers, json=data, stream=True) as response:
|
126 |
if response.status_code != 200:
|
127 |
error_details = response.json().get("error", "No error message provided")
|
128 |
raise APIError("TTS Error: OPENAI API error", status_code=response.status_code, details=error_details)
|
|
|
102 |
try:
|
103 |
if self.config.tts.type == "OPENAI_API":
|
104 |
data = {"model": self.config.tts.name, "input": text, "voice": "alloy", "response_format": "opus"}
|
105 |
+
response = requests.post(self.config.tts.url + "/audio/speech", headers=headers, json=data)
|
106 |
elif self.config.tts.type == "HF_API":
|
107 |
response = requests.post(self.config.tts.url, headers=headers, json={"inputs": text})
|
108 |
if response.status_code != 200:
|
|
|
122 |
data = {"model": self.config.tts.name, "input": text, "voice": "alloy", "response_format": "opus"}
|
123 |
|
124 |
try:
|
125 |
+
with requests.post(self.config.tts.url + "/audio/speech", headers=headers, json=data, stream=True) as response:
|
126 |
if response.status_code != 200:
|
127 |
error_details = response.json().get("error", "No error message provided")
|
128 |
raise APIError("TTS Error: OPENAI API error", status_code=response.status_code, details=error_details)
|