update app.py
Browse files
app.py
CHANGED
|
@@ -17,6 +17,42 @@ MODELS = {
|
|
| 17 |
"Tire Cord": "smartfalcon-ai/Tire-Cord-Defect-Detection"
|
| 18 |
}
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
sessions = {}
|
| 21 |
|
| 22 |
def get_session(model_name):
|
|
@@ -108,7 +144,8 @@ demo = gr.Interface(
|
|
| 108 |
],
|
| 109 |
outputs=gr.Image(type="numpy"),
|
| 110 |
title="Industrial Defect Detection",
|
| 111 |
-
description="Upload an image, select the defect model, and adjust the confidence threshold."
|
|
|
|
| 112 |
)
|
| 113 |
|
| 114 |
if __name__ == "__main__":
|
|
|
|
| 17 |
"Tire Cord": "smartfalcon-ai/Tire-Cord-Defect-Detection"
|
| 18 |
}
|
| 19 |
|
| 20 |
+
# Example images for each model (3 examples per task)
|
| 21 |
+
EXAMPLES = [
|
| 22 |
+
# Dental Implant
|
| 23 |
+
["examples/dental-implant-1.jpg", "Dental Implant", 0.25],
|
| 24 |
+
["examples/dental-implant-2.jpg", "Dental Implant", 0.25],
|
| 25 |
+
["examples/dental-implant-3.jpg", "Dental Implant", 0.25],
|
| 26 |
+
# Data Matrix
|
| 27 |
+
["examples/data-matrix-1.jpg", "Data Matrix", 0.25],
|
| 28 |
+
["examples/data-matrix-2.jpg", "Data Matrix", 0.25],
|
| 29 |
+
["examples/data-matrix-3.jpg", "Data Matrix", 0.25],
|
| 30 |
+
# Ball Pen
|
| 31 |
+
["examples/ball-pen-1.jpg", "Ball Pen", 0.25],
|
| 32 |
+
["examples/ball-pen-2.jpg", "Ball Pen", 0.25],
|
| 33 |
+
["examples/ball-pen-3.jpg", "Ball Pen", 0.25],
|
| 34 |
+
# Knit Up
|
| 35 |
+
["examples/knit-up-1.jpg", "Knit Up", 0.25],
|
| 36 |
+
["examples/knit-up-2.jpg", "Knit Up", 0.25],
|
| 37 |
+
["examples/knit-up-3.jpg", "Knit Up", 0.25],
|
| 38 |
+
# Knit Back
|
| 39 |
+
["examples/knit-back-1.jpg", "Knit Back", 0.25],
|
| 40 |
+
["examples/knit-back-2.jpg", "Knit Back", 0.25],
|
| 41 |
+
["examples/knit-back-3.jpg", "Knit Back", 0.25],
|
| 42 |
+
# Jean Back
|
| 43 |
+
["examples/jean-back-1.jpg", "Jean Back", 0.25],
|
| 44 |
+
["examples/jean-back-2.jpg", "Jean Back", 0.25],
|
| 45 |
+
["examples/jean-back-3.jpg", "Jean Back", 0.25],
|
| 46 |
+
# Jean Up
|
| 47 |
+
["examples/jean-up-1.jpg", "Jean Up", 0.25],
|
| 48 |
+
["examples/jean-up-2.jpg", "Jean Up", 0.25],
|
| 49 |
+
["examples/jean-up-3.jpg", "Jean Up", 0.25],
|
| 50 |
+
# Tire Cord
|
| 51 |
+
["examples/tire-cord-1.jpg", "Tire Cord", 0.25],
|
| 52 |
+
["examples/tire-cord-2.jpg", "Tire Cord", 0.25],
|
| 53 |
+
["examples/tire-cord-3.jpg", "Tire Cord", 0.25],
|
| 54 |
+
]
|
| 55 |
+
|
| 56 |
sessions = {}
|
| 57 |
|
| 58 |
def get_session(model_name):
|
|
|
|
| 144 |
],
|
| 145 |
outputs=gr.Image(type="numpy"),
|
| 146 |
title="Industrial Defect Detection",
|
| 147 |
+
description="Upload an image, select the defect model, and adjust the confidence threshold.",
|
| 148 |
+
examples=EXAMPLES
|
| 149 |
)
|
| 150 |
|
| 151 |
if __name__ == "__main__":
|