el-el-san commited on
Commit
738703f
·
verified ·
1 Parent(s): aa4fd90

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -39,8 +39,12 @@ MAX_IMAGE_SIZE = 1216
39
 
40
 
41
  @spaces.GPU
42
- def infer(use_image, prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps, image: PIL.Image.Image = None) -> PIL.Image.Image:
 
43
  # Check if the input image is a valid PIL Image and is not empty
 
 
 
44
  if use_image and image is not None :
45
  width, height = image['composite'].size
46
  ratio = np.sqrt(1024. * 1024. / (width * height))
@@ -106,7 +110,7 @@ with gr.Blocks(css=css) as demo:
106
 
107
  run_button = gr.Button("Run", scale=0)
108
 
109
- image = gr.ImageEditor(type="pil", image_mode="L", crop_size=(512, 512))
110
  result = gr.Image(label="Result", show_label=False)
111
 
112
  use_image = gr.Checkbox(label="Use image", value=True)
@@ -166,7 +170,8 @@ with gr.Blocks(css=css) as demo:
166
 
167
  run_button.click(lambda x: None, inputs=None, outputs=result).then(
168
  fn=infer,
169
- inputs=[use_image, prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps,image],
 
170
  outputs=[result]
171
  )
172
 
 
39
 
40
 
41
  @spaces.GPU
42
+ #def infer(use_image, prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps, image: PIL.Image.Image = None) -> PIL.Image.Image:
43
+ def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps):
44
  # Check if the input image is a valid PIL Image and is not empty
45
+ use_image = False
46
+ image = None
47
+
48
  if use_image and image is not None :
49
  width, height = image['composite'].size
50
  ratio = np.sqrt(1024. * 1024. / (width * height))
 
110
 
111
  run_button = gr.Button("Run", scale=0)
112
 
113
+ #image = gr.ImageEditor(type="pil", image_mode="L", crop_size=(512, 512))
114
  result = gr.Image(label="Result", show_label=False)
115
 
116
  use_image = gr.Checkbox(label="Use image", value=True)
 
170
 
171
  run_button.click(lambda x: None, inputs=None, outputs=result).then(
172
  fn=infer,
173
+ #inputs=[use_image, prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps,image],
174
+ inputs=[prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps],
175
  outputs=[result]
176
  )
177