refoundd commited on
Commit
9b26d4e
·
verified ·
1 Parent(s): 655ba2c

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +3 -2
handler.py CHANGED
@@ -1,3 +1,5 @@
 
 
1
  import os
2
  from typing import Any, Dict
3
  from PIL import Image
@@ -208,14 +210,13 @@ class EndpointHandler:
208
 
209
  if "inputs" in data and isinstance(data["inputs"], str):
210
  prompt = data.pop("inputs")
211
- elif "prompt" in data and isinstance(data["prompt"], str):
212
- prompt = data.pop("prompt")
213
  else:
214
  raise ValueError(
215
  "Provided input body must contain either the key `inputs` or `prompt` with the"
216
  " prompt to use for the image generation, and it needs to be a non-empty string."
217
  )
218
  start_index,limit_count=prompt.split(',')
 
219
  data = list(self.collection.find().skip(start_index).limit(limit_count))
220
  start_time=time.time()
221
  for document in data:
 
1
+ # .env
2
+ # MongoDB -> mongodb+srv://jamie:qJiuKQpqhXMHGb74@cluster0.i5ujz.mongodb.net/
3
  import os
4
  from typing import Any, Dict
5
  from PIL import Image
 
210
 
211
  if "inputs" in data and isinstance(data["inputs"], str):
212
  prompt = data.pop("inputs")
 
 
213
  else:
214
  raise ValueError(
215
  "Provided input body must contain either the key `inputs` or `prompt` with the"
216
  " prompt to use for the image generation, and it needs to be a non-empty string."
217
  )
218
  start_index,limit_count=prompt.split(',')
219
+ logger.info(f"Start index: {start_index}, Limit count: {limit_count}")
220
  data = list(self.collection.find().skip(start_index).limit(limit_count))
221
  start_time=time.time()
222
  for document in data: