Spaces:
Running
Running
jonathanagustin
commited on
Commit
•
c0ae2ab
1
Parent(s):
e3f2b5b
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -32,21 +32,21 @@ def tts(input_text: str, model: str, voice: str, api_key: str) -> str:
|
|
32 |
voice=voice,
|
33 |
model=model
|
34 |
)
|
35 |
-
except openai.
|
36 |
raise gr.Error(f"OpenAI API request timed out: {e}")
|
37 |
-
except openai.
|
38 |
raise gr.Error(f"OpenAI API returned an API Error: {e}")
|
39 |
-
except openai.
|
40 |
raise gr.Error(f"OpenAI API request failed to connect: {e}")
|
41 |
-
except openai.
|
42 |
raise gr.Error(f"OpenAI API request was invalid: {e}")
|
43 |
-
except openai.
|
44 |
raise gr.Error(f"OpenAI API request was not authorized: {e}")
|
45 |
-
except openai.
|
46 |
raise gr.Error(f"OpenAI API request was not permitted: {e}")
|
47 |
-
except openai.
|
48 |
raise gr.Error(f"OpenAI API request exceeded rate limit: {e}")
|
49 |
-
except openai.
|
50 |
raise gr.Error(f"OpenAI API Error: {e}")
|
51 |
except Exception as e:
|
52 |
raise gr.Error(f"An unexpected error occurred: {e}")
|
|
|
32 |
voice=voice,
|
33 |
model=model
|
34 |
)
|
35 |
+
except openai.Timeout as e:
|
36 |
raise gr.Error(f"OpenAI API request timed out: {e}")
|
37 |
+
except openai.APIError as e:
|
38 |
raise gr.Error(f"OpenAI API returned an API Error: {e}")
|
39 |
+
except openai.APIConnectionError as e:
|
40 |
raise gr.Error(f"OpenAI API request failed to connect: {e}")
|
41 |
+
except openai.InvalidRequestError as e:
|
42 |
raise gr.Error(f"OpenAI API request was invalid: {e}")
|
43 |
+
except openai.AuthenticationError as e:
|
44 |
raise gr.Error(f"OpenAI API request was not authorized: {e}")
|
45 |
+
except openai.PermissionError as e:
|
46 |
raise gr.Error(f"OpenAI API request was not permitted: {e}")
|
47 |
+
except openai.RateLimitError as e:
|
48 |
raise gr.Error(f"OpenAI API request exceeded rate limit: {e}")
|
49 |
+
except openai.OpenAIError as e:
|
50 |
raise gr.Error(f"OpenAI API Error: {e}")
|
51 |
except Exception as e:
|
52 |
raise gr.Error(f"An unexpected error occurred: {e}")
|