diff --git a/demo_v2.py b/demo_v2.py index 4f66d53..8f450c9 100644 --- a/demo_v2.py +++ b/demo_v2.py @@ -476,8 +476,9 @@ def gradio_answer(chatbot, chat_state, img_list, temperature): def gradio_stream_answer(chatbot, chat_state, img_list, temperature): print('chat state', chat_state.get_prompt()) - if not isinstance(img_list[0], torch.Tensor): - chat.encode_img(img_list) + if len(img_list) > 0: + if not isinstance(img_list[0], torch.Tensor): + chat.encode_img(img_list) streamer = chat.stream_answer(conv=chat_state, img_list=img_list, temperature=temperature,