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

@ -2,6 +2,8 @@ from pathlib import Path
import gradio as gr
from modules import shared
refresh_symbol = '\U0001f504' # 🔄
with open(Path(__file__).resolve().parent / '../css/main.css', 'r') as f:
@ -14,6 +16,21 @@ with open(Path(__file__).resolve().parent / '../css/chat.js', 'r') as f:
chat_js = f.read()
def list_interface_input_elements(chat=False):
elements = ['max_new_tokens', 'seed', 'temperature', 'top_p', 'top_k', 'typical_p', 'repetition_penalty', 'encoder_repetition_penalty', 'no_repeat_ngram_size', 'min_length', 'do_sample', 'penalty_alpha', 'num_beams', 'length_penalty', 'early_stopping', 'add_bos_token', 'ban_eos_token', 'truncation_length', 'custom_stopping_strings']
if chat:
elements += ['name1', 'name2', 'greeting', 'context', 'end_of_turn', 'chat_prompt_size', 'chat_generation_attempts', 'stop_at_newline', 'mode']
return elements
def gather_interface_values(*args):
output = {}
for i, element in enumerate(shared.input_elements):
output[element] = args[i]
output['custom_stopping_strings'] = eval(f"[{output['custom_stopping_strings']}]")
return output
class ToolButton(gr.Button, gr.components.FormComponent):
"""Small button with single emoji as text, fits inside gradio forms"""