eliebak HF staff commited on
Commit
55e69ee
1 Parent(s): 09cda1f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -26,9 +26,13 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
26
  temperature=temperature,
27
  top_p=top_p,
28
  ):
29
- if chunk.token.text:
 
 
30
  response += chunk.token.text
31
- yield history + [(message, response)]
 
 
32
 
33
  # If the response is empty, yield a default message
34
  if not response:
 
26
  temperature=temperature,
27
  top_p=top_p,
28
  ):
29
+ if isinstance(chunk, str):
30
+ response += chunk
31
+ elif hasattr(chunk, 'token'):
32
  response += chunk.token.text
33
+ elif hasattr(chunk, 'generated_text'):
34
+ response += chunk.generated_text
35
+ yield history + [(message, response)]
36
 
37
  # If the response is empty, yield a default message
38
  if not response: