Spaces:
Runtime error
Runtime error
updated roboflow model to improve accuracy
Browse files
app.py
CHANGED
@@ -232,12 +232,21 @@ def fetchImage():
|
|
232 |
with CLIENT.use_configuration(custom_configuration):
|
233 |
result = CLIENT.infer(
|
234 |
file_name, model_id="car-recognition-v4/4")
|
235 |
-
print(result)
|
236 |
-
threshold = 0.3 # Adjust this as needed
|
237 |
filtered_labels = [item
|
238 |
for item in result["predictions"] if item["confidence"] >= threshold]
|
239 |
|
240 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
labels = filtered_labels
|
242 |
print(labels)
|
243 |
for class_ in labels:
|
|
|
232 |
with CLIENT.use_configuration(custom_configuration):
|
233 |
result = CLIENT.infer(
|
234 |
file_name, model_id="car-recognition-v4/4")
|
|
|
|
|
235 |
filtered_labels = [item
|
236 |
for item in result["predictions"] if item["confidence"] >= threshold]
|
237 |
|
238 |
+
if filtered_labels == []:
|
239 |
+
i = 0.7
|
240 |
+
while filtered_labels == []:
|
241 |
+
i = i - 0.1
|
242 |
+
custom_configuration = InferenceConfiguration(
|
243 |
+
confidence_threshold=i)
|
244 |
+
with CLIENT.use_configuration(custom_configuration):
|
245 |
+
result = CLIENT.infer(
|
246 |
+
file_name, model_id="car-recognition-v4/4")
|
247 |
+
threshold = 0.3 # Adjust this as needed
|
248 |
+
filtered_labels = [item
|
249 |
+
for item in result["predictions"] if item["confidence"] >= threshold]
|
250 |
labels = filtered_labels
|
251 |
print(labels)
|
252 |
for class_ in labels:
|