Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -48,3 +48,13 @@ demo = gradio.Interface(
|
|
| 48 |
)
|
| 49 |
|
| 50 |
demo.launch(inline=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
)
|
| 49 |
|
| 50 |
demo.launch(inline=False)
|
| 51 |
+
|
| 52 |
+
def call_openai_api(messages):
|
| 53 |
+
try:
|
| 54 |
+
return openai.ChatCompletion.create(
|
| 55 |
+
model="gpt-3.5-turbo",
|
| 56 |
+
messages=messages
|
| 57 |
+
)
|
| 58 |
+
except Exception as e:
|
| 59 |
+
print(f"Error occurred: {e}")
|
| 60 |
+
return None
|