Spaces:
Sleeping
Sleeping
Commit
·
e542430
1
Parent(s):
9daeb8c
Update app.py
Browse files
app.py
CHANGED
@@ -48,19 +48,19 @@ def recommend_ai_model_via_gpt(description):
|
|
48 |
{"role": "user", "content": f"Given the application described as: '{description}', which AI model would be most suitable?"}
|
49 |
]
|
50 |
|
51 |
-
try:
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
recommendation = response['choices'][0]['message']['content'].strip()
|
57 |
return recommendation
|
58 |
-
except openai.APIError as e:
|
59 |
-
|
60 |
-
except openai.RateLimitError as e:
|
61 |
-
|
62 |
-
except openai.APIConnectionError as e:
|
63 |
-
|
64 |
|
65 |
|
66 |
def explain_recommendation(model_name):
|
@@ -68,19 +68,19 @@ def explain_recommendation(model_name):
|
|
68 |
{"role": "user", "content": f"Why would {model_name} be a suitable choice for the application?"}
|
69 |
]
|
70 |
|
71 |
-
try:
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
except openai.APIError as e:
|
79 |
-
|
80 |
-
except openai.RateLimitError as e:
|
81 |
-
|
82 |
-
except openai.APIConnectionError as e:
|
83 |
-
|
84 |
|
85 |
# Streamlit UI
|
86 |
st.image("./A8title2.png")
|
|
|
48 |
{"role": "user", "content": f"Given the application described as: '{description}', which AI model would be most suitable?"}
|
49 |
]
|
50 |
|
51 |
+
#try:
|
52 |
+
response = openai.ChatCompletion.create(
|
53 |
+
model="gpt-4",
|
54 |
+
messages=messages
|
55 |
+
)
|
56 |
recommendation = response['choices'][0]['message']['content'].strip()
|
57 |
return recommendation
|
58 |
+
#except openai.APIError as e:
|
59 |
+
# return f"Error: {e}"
|
60 |
+
#except openai.RateLimitError as e:
|
61 |
+
# return f"Rate limit exceeded: {e}"
|
62 |
+
#except openai.APIConnectionError as e:
|
63 |
+
# return f"Connection error: {e}"
|
64 |
|
65 |
|
66 |
def explain_recommendation(model_name):
|
|
|
68 |
{"role": "user", "content": f"Why would {model_name} be a suitable choice for the application?"}
|
69 |
]
|
70 |
|
71 |
+
#try:
|
72 |
+
response = openai.ChatCompletion.create(
|
73 |
+
model="gpt-4",
|
74 |
+
messages=messages
|
75 |
+
)
|
76 |
+
explanation = response['choices'][0]['message']['content'].strip()
|
77 |
+
return explanation
|
78 |
+
#except openai.APIError as e:
|
79 |
+
# return f"Error: {e}"
|
80 |
+
#except openai.RateLimitError as e:
|
81 |
+
# return f"Rate limit exceeded: {e}"
|
82 |
+
#except openai.APIConnectionError as e:
|
83 |
+
# return f"Connection error: {e}"
|
84 |
|
85 |
# Streamlit UI
|
86 |
st.image("./A8title2.png")
|