ysharma HF staff commited on
Commit
f06c5ef
·
1 Parent(s): f73c752

update debugging for image save step

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -62,18 +62,19 @@ def chat(image_in, in_steps, in_guidance_scale, in_img_guidance_scale, image_hid
62
  print("***First PASS:Image exists and will be deleted***")
63
  os.remove(img_name)
64
  edited_image.save(img_name) #, overwrite=True) #("/tmp/edited_image.png") #(img_nm)
65
- counter_out += 1
66
  history = history or []
67
  #Resizing (or not) the image for better display and adding supportive sample text
68
  add_text_list = ["There you go", "Enjoy your image!", "Nice work! Wonder what you gonna do next!", "Way to go!", "Does this work for you?", "Something like this?"]
69
- if counter_out == 0:
70
- response = random.choice(add_text_list) + '<img src="/file=' + img_name + '">'
71
  history.append((prompt, response))
72
- return history, history, edited_image, img_name, counter_out
73
  else:
74
- response = random.choice(add_text_list) + '<img src="/file=' + temp_img_name + '">'
75
  history.append((prompt, response))
76
- return history, history, edited_image, temp_img_name, counter_out
 
77
 
78
  with gr.Blocks() as demo:
79
  gr.Markdown("""<h1><center> Chat Interface with InstructPix2Pix: Give Image Editing Instructions [Apologies for inconvenience, this Space is still very much a work in progress...] </h1></center>
 
62
  print("***First PASS:Image exists and will be deleted***")
63
  os.remove(img_name)
64
  edited_image.save(img_name) #, overwrite=True) #("/tmp/edited_image.png") #(img_nm)
65
+ #counter_out += 1
66
  history = history or []
67
  #Resizing (or not) the image for better display and adding supportive sample text
68
  add_text_list = ["There you go", "Enjoy your image!", "Nice work! Wonder what you gonna do next!", "Way to go!", "Does this work for you?", "Something like this?"]
69
+ if counter_out > 0:
70
+ response = random.choice(add_text_list) + '<img src="/file=' + temp_img_name + '">'
71
  history.append((prompt, response))
72
+ return history, history, edited_image, temp_img_name, counter_out
73
  else:
74
+ response = random.choice(add_text_list) + '<img src="/file=' + img_name + '">'
75
  history.append((prompt, response))
76
+ counter_out += 1
77
+ return history, history, edited_image, img_name, counter_out
78
 
79
  with gr.Blocks() as demo:
80
  gr.Markdown("""<h1><center> Chat Interface with InstructPix2Pix: Give Image Editing Instructions [Apologies for inconvenience, this Space is still very much a work in progress...] </h1></center>