Sophie98 commited on
Commit
50a2182
1 Parent(s): 88c5e7a
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -105,7 +105,7 @@ def resize_style(img: Image.Image) -> Image.Image:
105
 
106
 
107
  def style_sofa(
108
- Input_image: np.ndarray, Style_image: np.ndarray, Choice_of_algorithm: str
109
  ) -> Image.Image:
110
  """
111
  Styles (all) the sofas in the image to the given style.
@@ -122,9 +122,8 @@ def style_sofa(
122
  id = randint(0, 10)
123
  print("Starting job ", id)
124
  # preprocess input images to fit requirements of the segmentation model
125
- input_img, style_img = Image.fromarray(Input_image), Image.fromarray(Style_image)
126
- resized_img, box = resize_sofa(fix_orient(input_img))
127
- resized_style = resize_style(fix_orient(style_img))
128
  # resized_style.save('resized_style.jpg')
129
  # generate mask for image
130
  print("generating mask...")
@@ -145,8 +144,8 @@ def style_sofa(
145
  demo = gr.Interface(
146
  style_sofa,
147
  inputs=[
148
- gr.inputs.Image(),
149
- gr.inputs.Image(),
150
  gr.inputs.Radio(
151
  ["Style Transformer", "Style FAST", "Style Projection"],
152
  default="Style FAST",
105
 
106
 
107
  def style_sofa(
108
+ Input_image: Image.Image, Style_image: Image.Image, Choice_of_algorithm: str
109
  ) -> Image.Image:
110
  """
111
  Styles (all) the sofas in the image to the given style.
122
  id = randint(0, 10)
123
  print("Starting job ", id)
124
  # preprocess input images to fit requirements of the segmentation model
125
+ resized_img, box = resize_sofa(fix_orient(Input_image))
126
+ resized_style = resize_style(fix_orient(Style_image))
 
127
  # resized_style.save('resized_style.jpg')
128
  # generate mask for image
129
  print("generating mask...")
144
  demo = gr.Interface(
145
  style_sofa,
146
  inputs=[
147
+ gr.inputs.Image(type="pil"),
148
+ gr.inputs.Image(type="pil"),
149
  gr.inputs.Radio(
150
  ["Style Transformer", "Style FAST", "Style Projection"],
151
  default="Style FAST",