jonathanagustin commited on
Commit
c0ae2ab
1 Parent(s): e3f2b5b

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +8 -8
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.error.Timeout as e:
36
  raise gr.Error(f"OpenAI API request timed out: {e}")
37
- except openai.error.APIError as e:
38
  raise gr.Error(f"OpenAI API returned an API Error: {e}")
39
- except openai.error.APIConnectionError as e:
40
  raise gr.Error(f"OpenAI API request failed to connect: {e}")
41
- except openai.error.InvalidRequestError as e:
42
  raise gr.Error(f"OpenAI API request was invalid: {e}")
43
- except openai.error.AuthenticationError as e:
44
  raise gr.Error(f"OpenAI API request was not authorized: {e}")
45
- except openai.error.PermissionError as e:
46
  raise gr.Error(f"OpenAI API request was not permitted: {e}")
47
- except openai.error.RateLimitError as e:
48
  raise gr.Error(f"OpenAI API request exceeded rate limit: {e}")
49
- except openai.error.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}")
 
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}")