Update app.py
Browse files
app.py
CHANGED
@@ -22,11 +22,11 @@ def pil_image_as_numpy_array(pilimg):
|
|
22 |
return img_array
|
23 |
|
24 |
def load_image_into_numpy_array(path):
|
|
|
25 |
image = None
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
return pil_image_as_numpy_array(image)
|
30 |
|
31 |
def load_model():
|
32 |
model_dir = 'saved_model'
|
@@ -73,7 +73,7 @@ example_image_paths = ["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]
|
76 |
-
example_outputs = [predict2(input_image) for input_image in
|
77 |
|
78 |
# Create the Gradio interface with examples using a for loop
|
79 |
examples = [[example_inputs[i], example_outputs[i]] for i in range(len(example_inputs))]
|
|
|
22 |
return img_array
|
23 |
|
24 |
def load_image_into_numpy_array(path):
|
25 |
+
|
26 |
image = None
|
27 |
+
image_data = tf.io.gfile.GFile(path, 'rb').read()
|
28 |
+
image = Image.open(BytesIO(image_data))
|
29 |
+
return pil_image_as_numpy_array(image)
|
|
|
30 |
|
31 |
def load_model():
|
32 |
model_dir = 'saved_model'
|
|
|
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]
|
76 |
+
example_outputs = [predict2(input_image) for input_image in example_image_paths]
|
77 |
|
78 |
# Create the Gradio interface with examples using a for loop
|
79 |
examples = [[example_inputs[i], example_outputs[i]] for i in range(len(example_inputs))]
|