wcy1122 commited on
Commit
c619862
1 Parent(s): e97863d

update code

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -184,10 +184,14 @@ def generate(state, imagebox, textbox, image_process_mode, gen_image, temperatur
184
  state.messages[-1][-1] = generated_text
185
  yield (state, state.to_gradio_chatbot(), "", None) + (disable_btn, disable_btn, disable_btn, enable_btn, enable_btn)
186
 
 
 
 
187
  if gen_image == 'Yes' and '<h>' in generated_text and '</h>' in generated_text:
188
  common_neg_prompt = "out of frame, lowres, text, error, cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, username, watermark, signature"
189
  prompt = generated_text.split("<h>")[1].split("</h>")[0]
190
  generated_text = generated_text.split("<h>")[0] + '\n' + 'Prompt: ' + prompt + '\n'
 
191
 
192
  torch.cuda.empty_cache()
193
  output_img = diffusion_pipe(prompt, negative_prompt=common_neg_prompt).images[0]
@@ -215,6 +219,7 @@ def add_text(state, imagebox, textbox, image_process_mode, gen_image):
215
  gen_image = 'Yes'
216
  elif 'show me one idea of what i could make with this?' in textbox.lower() and imagebox is not None:
217
  h, w = image.size
 
218
  if h == 922 and w == 672:
219
  gen_image = 'Yes'
220
  if gen_image == 'Yes':
 
184
  state.messages[-1][-1] = generated_text
185
  yield (state, state.to_gradio_chatbot(), "", None) + (disable_btn, disable_btn, disable_btn, enable_btn, enable_btn)
186
 
187
+ if gen_image == 'Yes':
188
+ print(generated_text)
189
+
190
  if gen_image == 'Yes' and '<h>' in generated_text and '</h>' in generated_text:
191
  common_neg_prompt = "out of frame, lowres, text, error, cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, username, watermark, signature"
192
  prompt = generated_text.split("<h>")[1].split("</h>")[0]
193
  generated_text = generated_text.split("<h>")[0] + '\n' + 'Prompt: ' + prompt + '\n'
194
+ print(prompt, '---------')
195
 
196
  torch.cuda.empty_cache()
197
  output_img = diffusion_pipe(prompt, negative_prompt=common_neg_prompt).images[0]
 
219
  gen_image = 'Yes'
220
  elif 'show me one idea of what i could make with this?' in textbox.lower() and imagebox is not None:
221
  h, w = image.size
222
+ print(h, w, '=====')
223
  if h == 922 and w == 672:
224
  gen_image = 'Yes'
225
  if gen_image == 'Yes':