From 3c9432f0390c1c1601177cd85dc38e940b91ce11 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Sun, 26 Feb 2023 02:37:21 -0300 Subject: [PATCH] Add checkbox to disable the character bias --- extensions/character_bias/script.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/extensions/character_bias/script.py b/extensions/character_bias/script.py index aa949f29..35b38c0e 100644 --- a/extensions/character_bias/script.py +++ b/extensions/character_bias/script.py @@ -1,7 +1,8 @@ import gradio as gr params = { - "bias string": " *I speak in an annoyingly cute way*", + "activate": True, + "bias string": " *I am so happy*", } def input_modifier(string): @@ -26,11 +27,16 @@ def bot_prefix_modifier(string): behavior. """ - return f'{string} {params["bias string"].strip()} ' + if params['activate'] == True: + return f'{string} {params["bias string"].strip()} ' + else: + return string def ui(): # Gradio elements + activate = gr.Checkbox(value=params['activate'], label='Activate character bias') string = gr.Textbox(value=params["bias string"], label='Character bias') # Event functions to update the parameters in the backend string.change(lambda x: params.update({"bias string": x}), string, None) + activate.change(lambda x: params.update({"activate": x}), activate, None)