Upload app.py
Browse files
app.py
CHANGED
|
@@ -107,15 +107,16 @@ def predict(user_input,company):
|
|
| 107 |
]
|
| 108 |
|
| 109 |
# Create messages
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
|
|
|
| 119 |
prediction = f'Sorry, I encountered the following error: \n {e}'
|
| 120 |
|
| 121 |
|
|
|
|
| 107 |
]
|
| 108 |
|
| 109 |
# Create messages
|
| 110 |
+
try:
|
| 111 |
+
response = client.chat.completions.create(
|
| 112 |
+
model=model_name,
|
| 113 |
+
messages=prompt,
|
| 114 |
+
temperature=0
|
| 115 |
+
)
|
| 116 |
+
|
| 117 |
+
prediction = response.choices[0].message.content.strip()
|
| 118 |
+
except Exception as e:
|
| 119 |
+
|
| 120 |
prediction = f'Sorry, I encountered the following error: \n {e}'
|
| 121 |
|
| 122 |
|