Spaces:
Sleeping
Sleeping
Create roboflow_model.py
Browse files- roboflow_model.py +12 -0
roboflow_model.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from inference import InferencePipeline
|
| 2 |
+
|
| 3 |
+
# Initialize pipeline once
|
| 4 |
+
pipeline = InferencePipeline.init_with_workflow(
|
| 5 |
+
api_key="dxkgGGHSZ3DI8XzVn29U",
|
| 6 |
+
workspace_name="naveen-kumar-hnmil",
|
| 7 |
+
workflow_id="detect-count-and-visualize-5"
|
| 8 |
+
)
|
| 9 |
+
|
| 10 |
+
def predict_image(image_path: str):
|
| 11 |
+
result = pipeline.infer(image_path)
|
| 12 |
+
return result["output_image"].numpy_image # This is a NumPy image
|