diff options
| author | Pseudozoid <sarathmadhavr@gmail.com> | 2024-04-21 13:03:50 +0530 |
|---|---|---|
| committer | Pseudozoid <sarathmadhavr@gmail.com> | 2024-04-21 13:03:50 +0530 |
| commit | b08f804766e9bf6689424fec56633f5e81d96218 (patch) | |
| tree | 84428fb730e020bcee671e9bbde9cfb3648e1212 | |
| parent | ae765911121bd4bb415237033f7a914a6b6536d5 (diff) | |
added json output for prediction
| -rw-r--r-- | main.py | 18 | ||||
| -rw-r--r-- | syringe.jpg | bin | 0 -> 259592 bytes | |||
| -rw-r--r-- | test.txt | 0 |
3 files changed, 18 insertions, 0 deletions
@@ -0,0 +1,18 @@ +from roboflow import Roboflow +import json +rf = Roboflow(api_key="otKMUXAELXaU2XZsT77M") +project = rf.workspace().project("biomedical-wastes") +model = project.version(3).model + +# infer on a local image +json_response = model.predict("./syringe.jpg", confidence=40, overlap=30).json() + +# save the JSON response to a file +with open('output.json', 'w') as f: + json.dump(json_response, f) + +# visualize your prediction +# model.predict("your_image.jpg", confidence=40, overlap=30).save("prediction.jpg") + +# infer on an image hosted elsewhere +# print(model.predict("URL_OF_YOUR_IMAGE", hosted=True, confidence=40, overlap=30).json())
\ No newline at end of file diff --git a/syringe.jpg b/syringe.jpg Binary files differnew file mode 100644 index 0000000..83ddc67 --- /dev/null +++ b/syringe.jpg diff --git a/test.txt b/test.txt deleted file mode 100644 index e69de29..0000000 --- a/test.txt +++ /dev/null |
