WonwoongCho commited on
Commit
3afe89d
·
1 Parent(s): a7c4279

debugging app.py

Browse files
Files changed (2) hide show
  1. app.py +3 -4
  2. src/utils_sample.py +0 -1
app.py CHANGED
@@ -13,8 +13,8 @@ import os
13
 
14
 
15
  @spaces.GPU
16
- def process_image_and_text(image, text, pipe):
17
-
18
  # image = Image.open(img_path).convert('RGB')
19
  image = resize_and_add_margin(image, target_size=512)
20
 
@@ -141,7 +141,6 @@ def create_app(
141
  output_image = gr.Image(type="pil", elem_id="output")
142
 
143
 
144
- set_seed(seed)
145
  blended_attn_procs = {}
146
  for name, _ in pipe.transformer.attn_processors.items():
147
  if "single" in name:
@@ -180,7 +179,7 @@ def create_app(
180
 
181
  submit_btn.click(
182
  fn=process_image_and_text,
183
- inputs=[original_image, text, pipe],
184
  outputs=output_image,
185
  )
186
 
 
13
 
14
 
15
  @spaces.GPU
16
+ def process_image_and_text(image, text, pipe, seed):
17
+ set_seed(seed)
18
  # image = Image.open(img_path).convert('RGB')
19
  image = resize_and_add_margin(image, target_size=512)
20
 
 
141
  output_image = gr.Image(type="pil", elem_id="output")
142
 
143
 
 
144
  blended_attn_procs = {}
145
  for name, _ in pipe.transformer.attn_processors.items():
146
  if "single" in name:
 
179
 
180
  submit_btn.click(
181
  fn=process_image_and_text,
182
+ inputs=[original_image, text, pipe, seed],
183
  outputs=output_image,
184
  )
185
 
src/utils_sample.py CHANGED
@@ -10,7 +10,6 @@ def set_seed(seed: int):
10
  Args:
11
  seed (int): The seed value to set.
12
  """
13
- seed = int(seed) # Ensure it's a real int, not a Gradio Number
14
  random.seed(seed)
15
  np.random.seed(seed)
16
  torch.manual_seed(seed)
 
10
  Args:
11
  seed (int): The seed value to set.
12
  """
 
13
  random.seed(seed)
14
  np.random.seed(seed)
15
  torch.manual_seed(seed)