mikemin027 commited on
Commit
b6b3aee
1 Parent(s): 3eee526

Updated the respond function to print out print(token) statement

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -39,7 +39,14 @@ def respond(
39
  )
40
 
41
  for token in response:
42
- yield token['choices'][0]['delta']['content']
 
 
 
 
 
 
 
43
 
44
  demo = gr.ChatInterface(
45
  respond,
 
39
  )
40
 
41
  for token in response:
42
+ # Print the token to debug the structure
43
+ print(token)
44
+ # Adjust based on the actual structure of the response
45
+ if 'choices' in token and len(token['choices']) > 0:
46
+ content = token['choices'][0].get('delta', {}).get('content', '')
47
+ yield content
48
+ else:
49
+ yield "No valid response received."
50
 
51
  demo = gr.ChatInterface(
52
  respond,