amosfang commited on
Commit
5677c31
1 Parent(s): 933acbd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -18,7 +18,7 @@ category_index = label_map_util.create_category_index_from_labelmap(PATH_TO_LABE
18
  def pil_image_as_numpy_array(pilimg):
19
 
20
  img_array = tf.keras.utils.img_to_array(pilimg)
21
- img_array = np.expand_dims(img_array, axis=0)
22
  return img_array
23
 
24
  def load_image_into_numpy_array(path):
@@ -37,6 +37,7 @@ def load_model():
37
  def predict(image_np):
38
 
39
  image_np = pil_image_as_numpy_array(image_np)
 
40
 
41
  results = detection_model(image_np)
42
 
@@ -69,7 +70,7 @@ def predict2(pilimg):
69
  detection_model = load_model()
70
 
71
  # Specify paths to example images
72
- example_image_paths = ["test_1.jpg", "test_1.jpg"]
73
 
74
  # Create a list of example inputs and outputs using a for loop
75
  example_inputs = [Image.open(path) for path in example_image_paths]
 
18
  def pil_image_as_numpy_array(pilimg):
19
 
20
  img_array = tf.keras.utils.img_to_array(pilimg)
21
+ # img_array = np.expand_dims(img_array, axis=0)
22
  return img_array
23
 
24
  def load_image_into_numpy_array(path):
 
37
  def predict(image_np):
38
 
39
  image_np = pil_image_as_numpy_array(image_np)
40
+ image_np = np.expand_dims(image_np, axis=0)
41
 
42
  results = detection_model(image_np)
43
 
 
70
  detection_model = load_model()
71
 
72
  # Specify paths to example images
73
+ example_image_paths = ["test_1.jpg"]
74
 
75
  # Create a list of example inputs and outputs using a for loop
76
  example_inputs = [Image.open(path) for path in example_image_paths]