Spaces:
Runtime error
Runtime error
updated roboflow model to improve accuracy
Browse files
app.py
CHANGED
|
@@ -39,7 +39,7 @@ from PIL import Image
|
|
| 39 |
import os
|
| 40 |
from sklearn.model_selection import train_test_split
|
| 41 |
from sklearn.preprocessing import MinMaxScaler
|
| 42 |
-
from inference_sdk import InferenceHTTPClient
|
| 43 |
|
| 44 |
# Initialize Flask app
|
| 45 |
app = Flask(__name__)
|
|
@@ -264,7 +264,11 @@ def fetchImage():
|
|
| 264 |
print(file_name)
|
| 265 |
|
| 266 |
# Set confidence threshold to 50%
|
| 267 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 268 |
threshold = 0.3 # Adjust this as needed
|
| 269 |
filtered_labels = [item["class"]
|
| 270 |
for item in result["predictions"] if item["confidence"] >= threshold]
|
|
|
|
| 39 |
import os
|
| 40 |
from sklearn.model_selection import train_test_split
|
| 41 |
from sklearn.preprocessing import MinMaxScaler
|
| 42 |
+
from inference_sdk import InferenceHTTPClient, InferenceConfiguration
|
| 43 |
|
| 44 |
# Initialize Flask app
|
| 45 |
app = Flask(__name__)
|
|
|
|
| 264 |
print(file_name)
|
| 265 |
|
| 266 |
# Set confidence threshold to 50%
|
| 267 |
+
custom_configuration = InferenceConfiguration(confidence_threshold=0.8)
|
| 268 |
+
with CLIENT.use_configuration(custom_configuration):
|
| 269 |
+
result = CLIENT.infer(
|
| 270 |
+
file_name, model_id="car-damage-detection-krsix/1")
|
| 271 |
+
print(result)
|
| 272 |
threshold = 0.3 # Adjust this as needed
|
| 273 |
filtered_labels = [item["class"]
|
| 274 |
for item in result["predictions"] if item["confidence"] >= threshold]
|