yizhangliu commited on
Commit
5db5ac8
·
1 Parent(s): 38af3c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -134,7 +134,7 @@ model = ModelManager(
134
  device=device,
135
  )
136
 
137
- image_type = 'filepath' #'pil'
138
  def predict(input):
139
  if image_type == 'filepath':
140
  # input: {'image': '/tmp/tmp8mn9xw93.png', 'mask': '/tmp/tmpn5ars4te.png'}
@@ -148,7 +148,8 @@ def predict(input):
148
  mask_pil = input['mask']
149
  image = np.array(image_pil)
150
  mask = np.array(mask_pil.convert("L"))
151
- output = model_process(image, mask)
 
152
  return output
153
 
154
  css = '''
@@ -196,7 +197,7 @@ with image_blocks as demo:
196
  with gr.Box():
197
  with gr.Row():
198
  with gr.Column():
199
- image = gr.Image(source='upload', elem_id="image_upload", shape=(512,512),tool='sketch', type=f'{image_type}', label="Upload").style(mobile_collapse=False, height=512)
200
  with gr.Row(elem_id="prompt-container").style(mobile_collapse=False, equal_height=True):
201
  btn_in = gr.Button("Done!").style(
202
  margin=True,
 
134
  device=device,
135
  )
136
 
137
+ image_type = 'pil' # filepath' #'pil'
138
  def predict(input):
139
  if image_type == 'filepath':
140
  # input: {'image': '/tmp/tmp8mn9xw93.png', 'mask': '/tmp/tmpn5ars4te.png'}
 
148
  mask_pil = input['mask']
149
  image = np.array(image_pil)
150
  mask = np.array(mask_pil.convert("L"))
151
+ output = mask_pil
152
+ # output = model_process(image, mask)
153
  return output
154
 
155
  css = '''
 
197
  with gr.Box():
198
  with gr.Row():
199
  with gr.Column():
200
+ image = gr.Image(source='upload', elem_id="image_upload",tool='sketch', type=f'{image_type}', label="Upload").style(mobile_collapse=False, height=512)
201
  with gr.Row(elem_id="prompt-container").style(mobile_collapse=False, equal_height=True):
202
  btn_in = gr.Button("Done!").style(
203
  margin=True,