koenverhagen commited on
Commit
5a6ca0c
1 Parent(s): e9497e3
Files changed (2) hide show
  1. Dockerfile +1 -1
  2. createlookalike.py +7 -7
Dockerfile CHANGED
@@ -8,5 +8,5 @@ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
8
 
9
  COPY . .
10
 
11
- CMD ["uvicorn", "server:app", "--reload", "--host", "0.0.0.0", "--port", "7860", "--timeout","90","--graceful-timeout","90"]
12
 
 
8
 
9
  COPY . .
10
 
11
+ CMD ["uvicorn", "server:app", "--reload", "--host", "0.0.0.0", "--port", "7860"]
12
 
createlookalike.py CHANGED
@@ -66,13 +66,13 @@ def load_image(url, img_id):
66
  return img, x
67
 
68
 
69
- async def create_feature_files(shop: Shop):
70
  model = keras.applications.VGG16(weights='imagenet', include_top=True)
71
  feat_extractor = Model(inputs=model.input, outputs=model.get_layer("fc2").output)
72
- await calculate_shop(shop, feat_extractor)
73
 
74
 
75
- async def calculate_shop(shop: Shop, feat_extractor) -> None:
76
  if shop.id: # temp
77
  print(shop.id, shop.base_url, datetime.now())
78
  google_xml_feed_url = '{}/google_xml_feed'.format(shop.base_url)
@@ -140,14 +140,14 @@ async def calculate_shop(shop: Shop, feat_extractor) -> None:
140
  }
141
 
142
  # print(design_dict)
143
- if await push_home(design_dict, shop):
144
  pass
145
  else:
146
  print("error sending recommendations")
147
 
148
  # if calculation is ready send update home
149
  print(f"step3: {datetime.now()}")
150
- if await update_calculation_date(shop):
151
  pass
152
  else:
153
  print("error sending shop calculation update")
@@ -159,7 +159,7 @@ async def calculate_shop(shop: Shop, feat_extractor) -> None:
159
 
160
 
161
 
162
- async def push_home(design_dict, shop):
163
  headers: dict[str, str] = {
164
  "Authorization": API_KEY,
165
  "Content-type": "application/json",
@@ -175,7 +175,7 @@ async def push_home(design_dict, shop):
175
  return False
176
 
177
 
178
- async def update_calculation_date(shop):
179
  headers: dict[str, str] = {
180
  "Authorization": API_KEY,
181
  "Content-type": "application/json",
 
66
  return img, x
67
 
68
 
69
+ def create_feature_files(shop: Shop):
70
  model = keras.applications.VGG16(weights='imagenet', include_top=True)
71
  feat_extractor = Model(inputs=model.input, outputs=model.get_layer("fc2").output)
72
+ calculate_shop(shop, feat_extractor)
73
 
74
 
75
+ def calculate_shop(shop: Shop, feat_extractor) -> None:
76
  if shop.id: # temp
77
  print(shop.id, shop.base_url, datetime.now())
78
  google_xml_feed_url = '{}/google_xml_feed'.format(shop.base_url)
 
140
  }
141
 
142
  # print(design_dict)
143
+ if push_home(design_dict, shop):
144
  pass
145
  else:
146
  print("error sending recommendations")
147
 
148
  # if calculation is ready send update home
149
  print(f"step3: {datetime.now()}")
150
+ if update_calculation_date(shop):
151
  pass
152
  else:
153
  print("error sending shop calculation update")
 
159
 
160
 
161
 
162
+ def push_home(design_dict, shop):
163
  headers: dict[str, str] = {
164
  "Authorization": API_KEY,
165
  "Content-type": "application/json",
 
175
  return False
176
 
177
 
178
+ def update_calculation_date(shop):
179
  headers: dict[str, str] = {
180
  "Authorization": API_KEY,
181
  "Content-type": "application/json",