Fix multimode interface double box on file upload (#8014)

* fix(chat_interface.py): fix 'submit_btn' not being set to 'None' when an instance of 'gr.MultimodalTextbox' is passed to 'textbox' argument of 'ChatInterface'

* fix typo

* add changeset

* fix(chat_interface.py): fix 'container' glitch for multimodal interface

* fix(chat_interface.py): fix bug where empty string is added to history when only a file or more was provided

* fix prior commit

* add changeset

* fix lines interchanged

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
This commit is contained in:
Sc077y 2024-04-13 01:37:16 +02:00 committed by GitHub
parent 299c87c477
commit e10ec6a612
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
"gradio": patch
---
fix:Fix multimode interface double box on file upload

View File

@ -202,7 +202,10 @@ class ChatInterface(Blocks):
with Group():
with Row():
if textbox:
textbox.container = False
if self.multimodal:
submit_btn = None
else:
textbox.container = False
textbox.show_label = False
textbox_ = textbox.render()
if not isinstance(textbox_, (Textbox, MultimodalTextbox)):
@ -469,7 +472,11 @@ class ChatInterface(Blocks):
):
for x in message["files"]:
history.append([(x,), None])
if message["text"] is not None and isinstance(message["text"], str):
if message["text"] is None or not isinstance(message["text"], str):
return
elif message["text"] == "" and message["files"] != []:
history.append([None, response])
else:
history.append([message["text"], response])
async def _display_input(