lichorosario commited on
Commit
89b7584
1 Parent(s): 87ccc57

feat: Refactor app.py to handle trigger word and style prompt

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -58,11 +58,11 @@ def infer(selected_index, prompt, style_prompt, inf_steps, guidance_scale, width
58
  )
59
  weight_name = result.result()[2]['value']
60
 
61
- if prompt.startswith(trigger_word):
62
- prompt = prompt[len(trigger_word):]
63
 
64
- if prompt.endswith(style_prompt):
65
- prompt = prompt[:-len(style_prompt)]
66
 
67
  prompt_arr = [trigger_word, prompt, style_prompt]
68
  prompt = '. '.join([element.strip() for element in prompt_arr if element.strip() != ''])
 
58
  )
59
  weight_name = result.result()[2]['value']
60
 
61
+ if trigger_word and prompt.startswith(trigger_word):
62
+ prompt = prompt[len(trigger_word):].lstrip()
63
 
64
+ if style_prompt and prompt.startswith(style_prompt):
65
+ prompt = prompt[len(style_prompt):].lstrip()
66
 
67
  prompt_arr = [trigger_word, prompt, style_prompt]
68
  prompt = '. '.join([element.strip() for element in prompt_arr if element.strip() != ''])