SD_models=['NeverEndingDream']# TODO: get with http://{address}}/sdapi/v1/sd-models and allow user to select
streaming_state=shared.args.no_stream# remember if chat streaming was enabled
picture_response=False# specifies if the next model response should appear as a picture
pic_id=0
defremove_surrounded_chars(string):
new_string=""
in_star=False
forcharinstring:
ifchar=='*':
in_star=notin_star
elifnotin_star:
new_string+=char
returnnew_string
# I don't even need input_hijack for this as visible text will be commited to history as the unmodified string
definput_modifier(string):
"""
Thisfunctionisappliedtoyourtextinputsbefore
theyarefedintothemodel.
"""
globalparams,picture_response
ifnotparams['enable_SD_api']:
returnstring
commands=['send','mail','me']
mediums=['image','pic','picture','photo']
subjects=['yourself','own']
lowstr=string.lower()
ifany(commandinlowstrforcommandincommands)andany(caseinlowstrforcaseinmediums):# trigger the generation if a command signature and a medium signature is found
picture_response=True
shared.args.no_stream=True# Disable streaming cause otherwise the SD-generated picture would return as a dud
shared.processing_message="*Is sending a picture...*"
string="Please provide a detailed description of your surroundings, how you look and the situation you're in and what you are doing right now"
ifany(targetinlowstrfortargetinsubjects):# the focus of the image should be on the sending character
string="Please provide a detailed and vivid description of how you look and what you are wearing"
returnstring
# Get and save the Stable Diffusion-generated picture
prompt_prefix=gr.Textbox(placeholder=params['prompt_prefix'],value=params['prompt_prefix'],label='Prompt Prefix (best used to describe the look of the character)')