Spaces:
Sleeping
Sleeping
Commit
·
5cea61f
1
Parent(s):
0b87b0f
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import openai
|
|
|
|
| 3 |
from openai.error import OpenAIError
|
| 4 |
import os
|
| 5 |
|
|
@@ -115,3 +116,14 @@ if st.session_state.rec_model_pressed:
|
|
| 115 |
else:
|
| 116 |
st.warning("Please provide a description.")
|
| 117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import openai
|
| 3 |
+
import openai.error
|
| 4 |
from openai.error import OpenAIError
|
| 5 |
import os
|
| 6 |
|
|
|
|
| 116 |
else:
|
| 117 |
st.warning("Please provide a description.")
|
| 118 |
|
| 119 |
+
|
| 120 |
+
try:
|
| 121 |
+
# OpenAI API call
|
| 122 |
+
except openai.APIError as e:
|
| 123 |
+
# Handle generic API errors
|
| 124 |
+
except openai.RateLimitError as e:
|
| 125 |
+
# Handle rate limit specific errors
|
| 126 |
+
except openai.APIConnectionError as e:
|
| 127 |
+
# Handle connection related errors
|
| 128 |
+
|
| 129 |
+
|