Fix send_pictures extension

This commit is contained in:
oobabooga 2023-04-12 10:27:06 -03:00
parent 49ce866c99
commit 80f4eabb2a
3 changed files with 35 additions and 33 deletions

View file

@ -6,6 +6,7 @@ import torch
from transformers import BlipForConditionalGeneration, BlipProcessor
from modules import chat, shared
from modules.ui import gather_interface_values
# If 'state' is True, will hijack the next chat generation with
# custom input text given by 'value' in the format [text, visible_text]
@ -42,7 +43,7 @@ def ui():
picture_select.upload(lambda picture, name1, name2: input_hijack.update({"state": True, "value": generate_chat_picture(picture, name1, name2)}), [picture_select, shared.gradio['name1'], shared.gradio['name2']], None)
# Call the generation function
picture_select.upload(chat.cai_chatbot_wrapper, shared.input_params, shared.gradio['display'], show_progress=shared.args.no_stream)
# Clear the picture from the upload field
picture_select.upload(lambda: None, [], [picture_select], show_progress=False)
picture_select.upload(
gather_interface_values, [shared.gradio[k] for k in shared.input_elements], shared.gradio['interface_state']).then(
chat.cai_chatbot_wrapper, shared.input_params, shared.gradio['display'], show_progress=shared.args.no_stream).then(
lambda: None, None, picture_select, show_progress=False)