jeremierostan commited on
Commit
57bb0c0
·
verified ·
1 Parent(s): e10a598

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import os
2
  import openai
3
  import gradio as gr
4
- import time
5
 
6
  # Set up password
7
  username = os.getenv('username')
@@ -38,9 +37,8 @@ def chat_with_assistant(message, history):
38
  # Handle the streaming response
39
  response_text = ""
40
  for chunk in response:
41
- delta = chunk['choices'][0]['delta']
42
- if 'content' in delta:
43
- response_text += delta['content']
44
  yield response_text
45
 
46
  # Custom CSS for chat bubbles and colors
 
1
  import os
2
  import openai
3
  import gradio as gr
 
4
 
5
  # Set up password
6
  username = os.getenv('username')
 
37
  # Handle the streaming response
38
  response_text = ""
39
  for chunk in response:
40
+ if hasattr(chunk.choices[0].delta, 'content'):
41
+ response_text += chunk.choices[0].delta.content
 
42
  yield response_text
43
 
44
  # Custom CSS for chat bubbles and colors