Clement Vachet commited on
Commit
bc42f94
·
1 Parent(s): a1a1640

Comment out query string parameters

Browse files
Files changed (1) hide show
  1. lambda_function.py +17 -9
lambda_function.py CHANGED
@@ -38,22 +38,30 @@ def detection_pipeline(model_type, image_bytes):
38
 
39
 
40
  def lambda_handler(event, context):
 
41
  try:
42
  # Get the model name from the query string parameters
43
  # Condition for local testing
44
- is_querystringparam = event.get('queryStringParameters')
45
- if is_querystringparam is not None:
46
- model_query = event['queryStringParameters'].get('model', '').lower()
47
- else:
48
- model_query = ""
49
- model_type = get_model_type(model_query)
50
- logger.info(f"Model query: {model_query}")
51
- logger.info(f"Model type: {model_type}")
 
 
52
 
53
  # Decode the base64-encoded image data from the event
54
- image_data = base64.b64decode(event['body'])
 
 
 
 
55
  result_dict = detection_pipeline(model_type, image_data)
56
  logger.info(f"API Results: {result_dict}")
 
57
  return {
58
  'statusCode': 200,
59
  'headers': {
 
38
 
39
 
40
  def lambda_handler(event, context):
41
+ logger.info(f"API event: {event}")
42
  try:
43
  # Get the model name from the query string parameters
44
  # Condition for local testing
45
+ # is_querystringparam = event.get('queryStringParameters')
46
+ # if is_querystringparam is not None:
47
+ # model_query = event['queryStringParameters'].get('model', '').lower()
48
+ # else:
49
+ # model_query = ""
50
+ # model_type = get_model_type(model_query)
51
+ # logger.info(f"Model query: {model_query}")
52
+ # logger.info(f"Model type: {model_type}")
53
+
54
+ model_type = get_model_type("")
55
 
56
  # Decode the base64-encoded image data from the event
57
+ image_data = event['body']
58
+ if event['isBase64Encoded']:
59
+ image_data = base64.b64decode(image_data)
60
+
61
+ # Run detection pipeline
62
  result_dict = detection_pipeline(model_type, image_data)
63
  logger.info(f"API Results: {result_dict}")
64
+
65
  return {
66
  'statusCode': 200,
67
  'headers': {