Spaces:
Sleeping
Sleeping
Commit
·
168ee0f
1
Parent(s):
5cea61f
Update app.py
Browse files
app.py
CHANGED
@@ -47,8 +47,12 @@ def recommend_ai_model_via_gpt(description):
|
|
47 |
)
|
48 |
recommendation = response['choices'][0]['message']['content'].strip()
|
49 |
return recommendation
|
50 |
-
except
|
51 |
return f"Error: {e}"
|
|
|
|
|
|
|
|
|
52 |
|
53 |
|
54 |
def explain_recommendation(model_name):
|
@@ -63,8 +67,12 @@ def explain_recommendation(model_name):
|
|
63 |
)
|
64 |
explanation = response['choices'][0]['message']['content'].strip()
|
65 |
return explanation
|
66 |
-
except
|
67 |
return f"Error: {e}"
|
|
|
|
|
|
|
|
|
68 |
|
69 |
# Streamlit UI
|
70 |
st.image("./A8title2.png")
|
@@ -124,6 +132,4 @@ except openai.APIError as e:
|
|
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 |
-
|
|
|
47 |
)
|
48 |
recommendation = response['choices'][0]['message']['content'].strip()
|
49 |
return recommendation
|
50 |
+
except openai.APIError as e:
|
51 |
return f"Error: {e}"
|
52 |
+
except openai.RateLimitError as e:
|
53 |
+
return f"Rate limit exceeded: {e}"
|
54 |
+
except openai.APIConnectionError as e:
|
55 |
+
return f"Connection error: {e}"
|
56 |
|
57 |
|
58 |
def explain_recommendation(model_name):
|
|
|
67 |
)
|
68 |
explanation = response['choices'][0]['message']['content'].strip()
|
69 |
return explanation
|
70 |
+
except openai.APIError as e:
|
71 |
return f"Error: {e}"
|
72 |
+
except openai.RateLimitError as e:
|
73 |
+
return f"Rate limit exceeded: {e}"
|
74 |
+
except openai.APIConnectionError as e:
|
75 |
+
return f"Connection error: {e}"
|
76 |
|
77 |
# Streamlit UI
|
78 |
st.image("./A8title2.png")
|
|
|
132 |
except openai.RateLimitError as e:
|
133 |
# Handle rate limit specific errors
|
134 |
except openai.APIConnectionError as e:
|
135 |
+
# Handle connection related errors
|
|
|
|