Spaces:
Running
on
Zero
Running
on
Zero
Update chatbot.py
Browse files- chatbot.py +2 -3
chatbot.py
CHANGED
@@ -265,7 +265,7 @@ def model_inference( user_prompt, chat_history, web_search):
|
|
265 |
final_prompt = f"{system_llava}\n{prompt}"
|
266 |
|
267 |
inputs = processor(prompt, image, return_tensors="pt").to("cuda", torch.float16)
|
268 |
-
streamer = TextIteratorStreamer(processor, **{"skip_special_tokens": True})
|
269 |
generation_kwargs = dict(inputs, streamer=streamer, max_new_tokens=1024)
|
270 |
generated_text = ""
|
271 |
|
@@ -275,8 +275,7 @@ def model_inference( user_prompt, chat_history, web_search):
|
|
275 |
buffer = ""
|
276 |
for new_text in streamer:
|
277 |
buffer += new_text
|
278 |
-
|
279 |
-
yield reply
|
280 |
|
281 |
# Create a chatbot interface
|
282 |
chatbot = gr.Chatbot(
|
|
|
265 |
final_prompt = f"{system_llava}\n{prompt}"
|
266 |
|
267 |
inputs = processor(prompt, image, return_tensors="pt").to("cuda", torch.float16)
|
268 |
+
streamer = TextIteratorStreamer(processor, skip_prompt=True, **{"skip_special_tokens": True})
|
269 |
generation_kwargs = dict(inputs, streamer=streamer, max_new_tokens=1024)
|
270 |
generated_text = ""
|
271 |
|
|
|
275 |
buffer = ""
|
276 |
for new_text in streamer:
|
277 |
buffer += new_text
|
278 |
+
yield buffer
|
|
|
279 |
|
280 |
# Create a chatbot interface
|
281 |
chatbot = gr.Chatbot(
|