Minor file uploading fixes

This commit is contained in:
oobabooga 2023-02-17 10:27:41 -03:00
parent 243244eeec
commit edc0262889

View File

@ -494,7 +494,7 @@ def create_settings_menus():
model_menu.change(load_model_wrapper, [model_menu], [model_menu], show_progress=True) model_menu.change(load_model_wrapper, [model_menu], [model_menu], show_progress=True)
preset_menu.change(load_preset_values, [preset_menu], [do_sample, temperature, top_p, typical_p, repetition_penalty, top_k, min_length, no_repeat_ngram_size, num_beams, penalty_alpha, length_penalty, early_stopping]) preset_menu.change(load_preset_values, [preset_menu], [do_sample, temperature, top_p, typical_p, repetition_penalty, top_k, min_length, no_repeat_ngram_size, num_beams, penalty_alpha, length_penalty, early_stopping])
softprompts_menu.change(load_soft_prompt, [softprompts_menu], [softprompts_menu], show_progress=True) softprompts_menu.change(load_soft_prompt, [softprompts_menu], [softprompts_menu], show_progress=True)
upload_softprompt.change(upload_soft_prompt, [upload_softprompt], [softprompts_menu]) upload_softprompt.upload(upload_soft_prompt, [upload_softprompt], [softprompts_menu])
return preset_menu, do_sample, temperature, top_p, typical_p, repetition_penalty, top_k, min_length, no_repeat_ngram_size, num_beams, penalty_alpha, length_penalty, early_stopping return preset_menu, do_sample, temperature, top_p, typical_p, repetition_penalty, top_k, min_length, no_repeat_ngram_size, num_beams, penalty_alpha, length_penalty, early_stopping
# This gets the new line characters right. # This gets the new line characters right.
@ -938,7 +938,7 @@ if args.chat or args.cai_chat:
with gr.Row(): with gr.Row():
with gr.Column(): with gr.Column():
gr.Markdown('Upload') gr.Markdown('Upload')
upload = gr.File(type='binary', file_types=[".json", ".txt"]) upload_chat_history = gr.File(type='binary', file_types=[".json", ".txt"])
with gr.Column(): with gr.Column():
gr.Markdown('Download') gr.Markdown('Download')
download = gr.File() download = gr.File()
@ -999,17 +999,17 @@ if args.chat or args.cai_chat:
textbox.submit(lambda : save_history(timestamp=False), [], [], show_progress=False) textbox.submit(lambda : save_history(timestamp=False), [], [], show_progress=False)
character_menu.change(load_character, [character_menu, name1, name2], [name2, context, display]) character_menu.change(load_character, [character_menu, name1, name2], [name2, context, display])
upload_img_tavern.change(upload_tavern_character, [upload_img_tavern, name1, name2], [character_menu]) upload_chat_history.upload(load_history, [upload_chat_history, name1, name2], [])
upload.change(load_history, [upload, name1, name2], []) upload_img_tavern.upload(upload_tavern_character, [upload_img_tavern, name1, name2], [character_menu])
upload_img_me.change(upload_your_profile_picture, [upload_img_me], []) upload_img_me.upload(upload_your_profile_picture, [upload_img_me], [])
if args.picture: if args.picture:
picture_select.change(lambda : None, [], [picture_select], show_progress=False) picture_select.upload(lambda : None, [], [picture_select], show_progress=False)
if args.cai_chat: if args.cai_chat:
upload.change(redraw_html, [name1, name2], [display]) upload_chat_history.upload(redraw_html, [name1, name2], [display])
upload_img_me.change(redraw_html, [name1, name2], [display]) upload_img_me.upload(redraw_html, [name1, name2], [display])
else: else:
upload.change(lambda : history['visible'], [], [display]) upload_chat_history.upload(lambda : history['visible'], [], [display])
upload_img_me.change(lambda : history['visible'], [], [display]) upload_img_me.upload(lambda : history['visible'], [], [display])
elif args.notebook: elif args.notebook:
with gr.Blocks(css=css, analytics_enabled=False) as interface: with gr.Blocks(css=css, analytics_enabled=False) as interface: