Spaces:
Sleeping
Sleeping
Vijay Daita
commited on
Commit
•
546df71
1
Parent(s):
2554ded
Initial release
Browse files- app.py +39 -0
- examples/.DS_Store +0 -0
- examples/b1.jpeg +0 -0
- examples/b2.jpeg +0 -0
- examples/m1.jpeg +0 -0
- examples/m2.jpeg +0 -0
- examples/nn1.jpeg +0 -0
- examples/nn2.jpeg +0 -0
- goodmodel.h5 +3 -0
- requirements.txt +4 -0
app.py
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import numpy as np
|
3 |
+
import pandas as pd
|
4 |
+
import keras
|
5 |
+
import tensorflow as tf
|
6 |
+
|
7 |
+
sep_model = keras.models.load_model("goodmodel.h5")
|
8 |
+
|
9 |
+
def process(input_img):
|
10 |
+
list_form = np.array([input_img])
|
11 |
+
print(list_form.shape)
|
12 |
+
results = sep_model.predict([list_form])
|
13 |
+
results = list(results[0])
|
14 |
+
print(results)
|
15 |
+
classification = ""
|
16 |
+
if results[0] > results[1] and results[0] > results[2]:
|
17 |
+
classification = "Benign"
|
18 |
+
elif results[1] > results[0] and results[1] > results[2]:
|
19 |
+
classification = "Malignant"
|
20 |
+
else:
|
21 |
+
classification = "Non-neoplastic"
|
22 |
+
print(classification)
|
23 |
+
return classification
|
24 |
+
|
25 |
+
demo = gr.Interface(process, gr.Image(shape=(240, 240)), "text",
|
26 |
+
title="Optimized Image Classification Models on Dark Skin Lesions",
|
27 |
+
description="Images that are not of skin lesions will throw off the model, as it will try to classify all images within the three categories.",
|
28 |
+
examples=[
|
29 |
+
["examples/b1.jpeg"],
|
30 |
+
["examples/b2.jpeg"],
|
31 |
+
["examples/m1.jpeg"],
|
32 |
+
["examples/m2.jpeg"],
|
33 |
+
["examples/nn1.jpeg"],
|
34 |
+
["examples/nn2.jpeg"]
|
35 |
+
|
36 |
+
],
|
37 |
+
interpretation="default"
|
38 |
+
)
|
39 |
+
demo.launch(share=True)
|
examples/.DS_Store
ADDED
Binary file (6.15 kB). View file
|
|
examples/b1.jpeg
ADDED
examples/b2.jpeg
ADDED
examples/m1.jpeg
ADDED
examples/m2.jpeg
ADDED
examples/nn1.jpeg
ADDED
examples/nn2.jpeg
ADDED
goodmodel.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5c49516718055efe0ebff3e088e3da58835853e67feb91d6588f047b2dc07a10
|
3 |
+
size 79730528
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
numpy==1.21.5
|
2 |
+
pandas==1.4.4
|
3 |
+
keras==2.12.0
|
4 |
+
tensorflow==2.12.0
|