paralym commited on
Commit
a64ea3c
1 Parent(s): de752b7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -39,7 +39,7 @@ from PIL import Image
39
  import requests
40
  from PIL import Image
41
  from io import BytesIO
42
- from transformers import TextStreamer
43
 
44
  import gradio as gr
45
  import gradio_client
@@ -248,7 +248,10 @@ def bot(history):
248
  stopping_criteria = KeywordsStoppingCriteria(
249
  keywords, our_chatbot.tokenizer, input_ids
250
  )
251
- streamer = TextStreamer(
 
 
 
252
  our_chatbot.tokenizer, skip_prompt=True, skip_special_tokens=True
253
  )
254
  print(our_chatbot.model.device)
 
39
  import requests
40
  from PIL import Image
41
  from io import BytesIO
42
+ from transformers import TextStreamer, TextIteratorStreamer
43
 
44
  import gradio as gr
45
  import gradio_client
 
248
  stopping_criteria = KeywordsStoppingCriteria(
249
  keywords, our_chatbot.tokenizer, input_ids
250
  )
251
+ # streamer = TextStreamer(
252
+ # our_chatbot.tokenizer, skip_prompt=True, skip_special_tokens=True
253
+ # )
254
+ streamer = TextIteratorStreamer(
255
  our_chatbot.tokenizer, skip_prompt=True, skip_special_tokens=True
256
  )
257
  print(our_chatbot.model.device)