OpenBMB / MiniCPM-V

MiniCPM-Llama3-V 2.5: A GPT-4V Level Multimodal LLM on Your Phone
Apache License 2.0
7.82k stars 543 forks source link

fix a bug with web_demo_streamlit_2.5.py at text mode #278

Open RainYooSuki opened 2 weeks ago

RainYooSuki commented 2 weeks ago

fix a bug with web_demo_streamlit_2.5:when use streamlit and chat in text mode,it would show an error. i found that when the text mode is chosed,the demo would still try to upload an image though there is not any image i upload. i fix it by adding 'image=none' instead of 'image=imagefile' when it is text mode and now it can use without any error.

原来的streamlit demo代码有问题,text模式下还会去读取image,导致一聊天就报错。看了下源码,在text模式下还会去尝试读上传的图🤨,解决办法就是加上一段if判断,当处于text模式的时候,image返回none就不报错了,实测也是可以正常对话了

RainYooSuki commented 2 weeks ago

可能其他demo也会有这个问题,不过我用的是minicpm 2.5,所以就只改了streamlit 2.5的demo,其他的我没试不清楚,如果官方看到了去看看呗,结尾model.chat那段前面加个if selected_mode == "Image":判断就好了,else情况下res = model.chat(image=None,...

RainYooSuki commented 2 weeks ago

CN SVQ~ 75%V7GAO~AQ EX3 这是改好后的效果