Update app.py
Browse files
app.py
CHANGED
@@ -6,8 +6,17 @@ pipeline = pipeline(task="image-classification", model="dqnguyen/vit-base_diabet
|
|
6 |
|
7 |
def predict(image):
|
8 |
predictions = pipeline(image)
|
9 |
-
return {p["label"]: p["score"] for p in predictions}
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
gr.Interface(
|
12 |
predict,
|
13 |
inputs=gr.inputs.Image(label="Upload an image (Tải một bức ảnh vét loét tiểu đường)", type="filepath"),
|
|
|
6 |
|
7 |
def predict(image):
|
8 |
predictions = pipeline(image)
|
9 |
+
#return {p["label"]: p["score"] for p in predictions}
|
10 |
+
results = {}
|
11 |
+
for p in predictions:
|
12 |
+
if p["label"] == "MoHat":
|
13 |
+
results["Granulation tissue (Mô hạt)"] = p["score"]
|
14 |
+
elif p["label"] == "MoGiaMacNhiemKhuan":
|
15 |
+
results["Pseudomembranous tissue with a bacterial infection (Mô giả mạc nhiễm khuẩn)"] = p["score"]
|
16 |
+
elif p["label"] == "MoHoaiTu":
|
17 |
+
results["Necrotic tissue (Mô hoại tử)"] = p["score"]
|
18 |
+
return results
|
19 |
+
|
20 |
gr.Interface(
|
21 |
predict,
|
22 |
inputs=gr.inputs.Image(label="Upload an image (Tải một bức ảnh vét loét tiểu đường)", type="filepath"),
|