forked from Pseudozoid/BinaryBreak
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
36 lines (17 loc) · 645 Bytes
/
Copy pathtest.py
File metadata and controls
36 lines (17 loc) · 645 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from roboflow import Roboflow
import json
rf = Roboflow(api_key="otKMUXAELXaU2XZsT77M")
project = rf.workspace().project("biomedical-wastes")
model = project.version(3).model
count = 0;
# infer on a local image
json_response = model.predict("./syringe.jpg", confidence=40, overlap=30).json()
threshold = 0.8
for prediction in json_response["predictions"]:
if prediction["confidence"] > threshold:
# Do something specific
print("Syringe detected!")
break;
# save the JSON response to a file
with open('output.json', 'w') as f:
json.dump(json_response, f)