Sophie98 commited on
Commit
d1be09c
1 Parent(s): acda9fe

added id per job

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -4,6 +4,7 @@ import gradio as gr
4
  from segmentation import get_mask,replace_sofa
5
  from styleTransfer import create_styledSofa
6
  from PIL import Image
 
7
 
8
  #https://colab.research.google.com/drive/11CtQpSeRBGAuw4TtE_rL470tRo-1X-p2#scrollTo=edGukUHXyymr
9
  #https://colab.research.google.com/drive/1xq33YKf0LVKCkbbUZIoNPzgpR_4Kd0qL#scrollTo=sPuM8Xypjs-c
@@ -89,7 +90,8 @@ def style_sofa(input_img: np.ndarray, style_img: np.ndarray):
89
  Return:
90
  new_sofa = image containing the styled sofa
91
  """
92
-
 
93
  # preprocess input images to be (640,640) squares to fit requirements of the segmentation model
94
  input_img,style_img = Image.fromarray(input_img),Image.fromarray(style_img)
95
  resized_img,box = resize_sofa(input_img)
@@ -107,6 +109,7 @@ def style_sofa(input_img: np.ndarray, style_img: np.ndarray):
107
  print('Replacing sofa...')
108
  new_sofa = replace_sofa(resized_img,mask,styled_sofa)
109
  new_sofa = new_sofa.crop(box)
 
110
  return new_sofa
111
 
112
  image = gr.inputs.Image()
 
4
  from segmentation import get_mask,replace_sofa
5
  from styleTransfer import create_styledSofa
6
  from PIL import Image
7
+ from random import randint
8
 
9
  #https://colab.research.google.com/drive/11CtQpSeRBGAuw4TtE_rL470tRo-1X-p2#scrollTo=edGukUHXyymr
10
  #https://colab.research.google.com/drive/1xq33YKf0LVKCkbbUZIoNPzgpR_4Kd0qL#scrollTo=sPuM8Xypjs-c
 
90
  Return:
91
  new_sofa = image containing the styled sofa
92
  """
93
+ id = randint(0, 10)
94
+ print('Starting job ', id)
95
  # preprocess input images to be (640,640) squares to fit requirements of the segmentation model
96
  input_img,style_img = Image.fromarray(input_img),Image.fromarray(style_img)
97
  resized_img,box = resize_sofa(input_img)
 
109
  print('Replacing sofa...')
110
  new_sofa = replace_sofa(resized_img,mask,styled_sofa)
111
  new_sofa = new_sofa.crop(box)
112
+ print('Finishing job', id)
113
  return new_sofa
114
 
115
  image = gr.inputs.Image()