Spaces:
Runtime error
Runtime error
updated roboflow model to improve accuracy
Browse files
app.py
CHANGED
@@ -112,7 +112,6 @@ def fetchImage():
|
|
112 |
print(f"Image downloaded and saved as {file_name}")
|
113 |
else:
|
114 |
print(f"Failed to download image. Status code: {response.status_code}")
|
115 |
-
# Load image
|
116 |
image = cv2.imread(file_name)
|
117 |
|
118 |
rf = Roboflow(api_key="LqD8Cs4OsoK8seO3CPkf")
|
@@ -262,8 +261,16 @@ def fetchImage():
|
|
262 |
api_url="https://detect.roboflow.com",
|
263 |
api_key="LqD8Cs4OsoK8seO3CPkf"
|
264 |
)
|
265 |
-
|
266 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
267 |
print(labels)
|
268 |
for class_ in labels:
|
269 |
total_cost += repair_costs.get(class_, 0)
|
|
|
112 |
print(f"Image downloaded and saved as {file_name}")
|
113 |
else:
|
114 |
print(f"Failed to download image. Status code: {response.status_code}")
|
|
|
115 |
image = cv2.imread(file_name)
|
116 |
|
117 |
rf = Roboflow(api_key="LqD8Cs4OsoK8seO3CPkf")
|
|
|
261 |
api_url="https://detect.roboflow.com",
|
262 |
api_key="LqD8Cs4OsoK8seO3CPkf"
|
263 |
)
|
264 |
+
print(file_name)
|
265 |
+
|
266 |
+
result = CLIENT.infer(file_name, model_id="car-damage-detection-krsix/1",
|
267 |
+
confidence=0.3) # Set confidence threshold to 50%
|
268 |
+
threshold = 0.3 # Adjust this as needed
|
269 |
+
filtered_labels = [item["class"]
|
270 |
+
for item in result["predictions"] if item["confidence"] >= threshold]
|
271 |
+
|
272 |
+
print(filtered_labels)
|
273 |
+
labels = filtered_labels
|
274 |
print(labels)
|
275 |
for class_ in labels:
|
276 |
total_cost += repair_costs.get(class_, 0)
|