Spaces:
Sleeping
Sleeping
Gaetano Parente commited on
Commit ·
c3cd511
1
Parent(s): 69b3dba
fix
Browse files
data/model/medical-image-classification.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:179db837e27060ab936729a443a0eb8e672edf2230bc1166137a0231e88c25ee
|
| 3 |
+
size 134089704
|
modules/image_classification.py
CHANGED
|
@@ -24,7 +24,7 @@ def image_predict(image_path, model_path):
|
|
| 24 |
return predictions, pred_labels
|
| 25 |
|
| 26 |
def image_classification(numpy_image):
|
| 27 |
-
model = MODEL + 'medical-image-classification.
|
| 28 |
myuuid = uuid.uuid4()
|
| 29 |
filename = 'test_' + str(myuuid) + '.png'
|
| 30 |
cv2.imwrite(filename, numpy_image)
|
|
|
|
| 24 |
return predictions, pred_labels
|
| 25 |
|
| 26 |
def image_classification(numpy_image):
|
| 27 |
+
model = MODEL + 'medical-image-classification.h5'
|
| 28 |
myuuid = uuid.uuid4()
|
| 29 |
filename = 'test_' + str(myuuid) + '.png'
|
| 30 |
cv2.imwrite(filename, numpy_image)
|
modules/multilabel_classification.py
CHANGED
|
@@ -42,11 +42,11 @@ def multi_classification(text):
|
|
| 42 |
tokenizer = TOKEN + 'multi-classification-tokenizer.json'
|
| 43 |
myuuid = uuid.uuid4()
|
| 44 |
filepath = BASE_PATH + 'temp' + str(myuuid) + '.txt'
|
| 45 |
-
try:
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
finally:
|
| 52 |
-
|
|
|
|
| 42 |
tokenizer = TOKEN + 'multi-classification-tokenizer.json'
|
| 43 |
myuuid = uuid.uuid4()
|
| 44 |
filepath = BASE_PATH + 'temp' + str(myuuid) + '.txt'
|
| 45 |
+
#try:
|
| 46 |
+
labels, max_label = predict(model, tokenizer, text, filepath)
|
| 47 |
+
response = {}
|
| 48 |
+
for i, label in enumerate(labels[0]):
|
| 49 |
+
response[class_names[i]] = "%.4f" % float(label)
|
| 50 |
+
return response
|
| 51 |
+
#finally:
|
| 52 |
+
# os.remove(filepath)
|