Add checkbox to disable the character bias
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
import gradio as gr
|
import gradio as gr
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
"bias string": " *I speak in an annoyingly cute way*",
|
"activate": True,
|
||||||
|
"bias string": " *I am so happy*",
|
||||||
}
|
}
|
||||||
|
|
||||||
def input_modifier(string):
|
def input_modifier(string):
|
||||||
@@ -26,11 +27,16 @@ def bot_prefix_modifier(string):
|
|||||||
behavior.
|
behavior.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if params['activate'] == True:
|
||||||
return f'{string} {params["bias string"].strip()} '
|
return f'{string} {params["bias string"].strip()} '
|
||||||
|
else:
|
||||||
|
return string
|
||||||
|
|
||||||
def ui():
|
def ui():
|
||||||
# Gradio elements
|
# Gradio elements
|
||||||
|
activate = gr.Checkbox(value=params['activate'], label='Activate character bias')
|
||||||
string = gr.Textbox(value=params["bias string"], label='Character bias')
|
string = gr.Textbox(value=params["bias string"], label='Character bias')
|
||||||
|
|
||||||
# Event functions to update the parameters in the backend
|
# Event functions to update the parameters in the backend
|
||||||
string.change(lambda x: params.update({"bias string": x}), string, None)
|
string.change(lambda x: params.update({"bias string": x}), string, None)
|
||||||
|
activate.change(lambda x: params.update({"activate": x}), activate, None)
|
||||||
|
|||||||
Reference in New Issue
Block a user