Spaces:
Build error
Build error
Commit
•
3bff423
1
Parent(s):
2b5dc41
Update app.py
Browse files
app.py
CHANGED
@@ -6,15 +6,14 @@ import gradio as gr
|
|
6 |
labels = {0: "melanoma", 1: "nevus", 2: "seborrheic_keratosis"}
|
7 |
|
8 |
def classify_image(inp):
|
9 |
-
|
10 |
-
|
11 |
-
)
|
12 |
-
img_array = tf.keras.utils.img_to_array(img)
|
13 |
-
img_array = tf.expand_dims(img_array, 0)
|
14 |
|
15 |
-
|
16 |
|
17 |
-
|
|
|
|
|
18 |
|
19 |
gr.Interface(fn=classify_image,
|
20 |
inputs=gr.inputs.Image(type="filepath"),
|
|
|
6 |
labels = {0: "melanoma", 1: "nevus", 2: "seborrheic_keratosis"}
|
7 |
|
8 |
def classify_image(inp):
|
9 |
+
image_array = tf.keras.preprocessing.image.img_to_array(
|
10 |
+
tf.keras.preprocessing.image.load_img(inp, target_size=(256,256)))
|
|
|
|
|
|
|
11 |
|
12 |
+
image_array_with_batchdim = image_array[np.newaxis, :]
|
13 |
|
14 |
+
model_prediction = np.argmax(model.predict(image_array_with_batchdim), axis=-1)[0]
|
15 |
+
|
16 |
+
return labels[model_prediction]
|
17 |
|
18 |
gr.Interface(fn=classify_image,
|
19 |
inputs=gr.inputs.Image(type="filepath"),
|