mirror of
https://github.com/gradio-app/gradio.git
synced 2025-02-17 11:29:58 +08:00
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:
parent
299c87c477
commit
e10ec6a612
5
.changeset/dull-garlics-lie.md
Normal file
5
.changeset/dull-garlics-lie.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"gradio": patch
|
||||
---
|
||||
|
||||
fix:Fix multimode interface double box on file upload
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user