wenjiao commited on
Commit
42cd650
1 Parent(s): 0236cd0
Files changed (1) hide show
  1. app.py +11 -15
app.py CHANGED
@@ -66,14 +66,11 @@ def img2img_generate(source_img, prompt, steps=25, strength=0.75, seed=42, guida
66
  img_io = BytesIO(img_byte) # convert image to file-like object
67
  img = Image.open(img_io) # img is now PIL Image object
68
  print("elapsed time: ", time.time() - start_time)
69
-
70
- if queue_size.isdigit():
71
- if int(queue_size) > 4:
72
- return [img, gr.update(visible=False), gr.update(visible=True)]
73
- elif int(queue_size) <= 4:
74
- return [img, gr.update(visible=True), gr.update(visible=False)]
75
- else:
76
- return [img, gr.update(visible=True), gr.update(visible=False)]
77
 
78
 
79
  def txt2img_generate(prompt, steps=25, seed=42, guidance_scale=7.5):
@@ -103,13 +100,12 @@ def txt2img_generate(prompt, steps=25, seed=42, guidance_scale=7.5):
103
  img = Image.open(img_io) # img is now PIL Image object
104
  print("elapsed time: ", time.time() - start_time)
105
 
106
- if queue_size.isdigit():
107
- if int(queue_size) > 4:
108
- return [img, gr.update(visible=False), gr.update(visible=True)]
109
- elif int(queue_size) <= 4:
110
- return [img, gr.update(visible=True), gr.update(visible=False)]
111
- else:
112
- return [img, gr.update(visible=True), gr.update(visible=False)]
113
 
114
 
115
  md = """
 
66
  img_io = BytesIO(img_byte) # convert image to file-like object
67
  img = Image.open(img_io) # img is now PIL Image object
68
  print("elapsed time: ", time.time() - start_time)
69
+
70
+ if int(queue_size) > 4:
71
+ return [img, gr.update(visible=False), gr.update(visible=True)]
72
+ elif int(queue_size) <= 4:
73
+ return [img, gr.update(visible=True), gr.update(visible=False)]
 
 
 
74
 
75
 
76
  def txt2img_generate(prompt, steps=25, seed=42, guidance_scale=7.5):
 
100
  img = Image.open(img_io) # img is now PIL Image object
101
  print("elapsed time: ", time.time() - start_time)
102
 
103
+
104
+ if int(queue_size) > 4:
105
+ return [img, gr.update(visible=False), gr.update(visible=True)]
106
+ elif int(queue_size) <= 4:
107
+ return [img, gr.update(visible=True), gr.update(visible=False)]
108
+
 
109
 
110
 
111
  md = """