myselfiefun commited on
Commit
f15c74f
·
verified ·
1 Parent(s): c75bf75

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -147,7 +147,9 @@ def generate_image(
147
  image_token_id = pipe.tokenizer.convert_tokens_to_ids(pipe.trigger_word)
148
  input_ids = pipe.tokenizer.encode(prompt)
149
  if image_token_id not in input_ids:
150
- raise gr.Error(f"Cannot find the trigger word '{pipe.trigger_word}' in text prompt! Please refer to step 2️⃣")
 
 
151
 
152
  if input_ids.count(image_token_id) > 1:
153
  raise gr.Error(f"Cannot use multiple trigger words '{pipe.trigger_word}' in text prompt!")
 
147
  image_token_id = pipe.tokenizer.convert_tokens_to_ids(pipe.trigger_word)
148
  input_ids = pipe.tokenizer.encode(prompt)
149
  if image_token_id not in input_ids:
150
+ prompt = "img" + prompt
151
+ input_ids = pipe.tokenizer.encode(prompt)
152
+ # raise gr.Error(f"Cannot find the trigger word '{pipe.trigger_word}' in text prompt! Please refer to step 2️⃣")
153
 
154
  if input_ids.count(image_token_id) > 1:
155
  raise gr.Error(f"Cannot use multiple trigger words '{pipe.trigger_word}' in text prompt!")