13
13
from roboflow .models .object_detection import ObjectDetectionModel
14
14
from roboflow .models .semantic_segmentation import SemanticSegmentationModel
15
15
16
+
16
17
def login (args ):
17
18
roboflow .login ()
18
19
@@ -110,25 +111,26 @@ def get_workspace(args):
110
111
api_key = load_roboflow_api_key (args .workspaceId )
111
112
workspace_json = rfapi .get_workspace (api_key , args .workspaceId )
112
113
print (json .dumps (workspace_json , indent = 2 ))
113
-
114
+
114
115
115
116
def run_video_inference_api (args ):
116
117
rf = roboflow .Roboflow (args .api_key )
117
118
project = rf .workspace ().project (args .project )
118
119
version = project .version (args .version_number )
119
120
model = project .version (version ).model
120
121
121
- #model = VideoInferenceModel(args.api_key, project.id, version.version, project.id) # Pass dataset_id
122
- # Pass model_id and version
122
+ # model = VideoInferenceModel(args.api_key, project.id, version.version, project.id) # Pass dataset_id
123
+ # Pass model_id and version
123
124
job_id , signed_url , expire_time = model .predict_video (
124
- args .video_file ,
125
- fps = 40 ,
126
- prediction_type = "batch-video" ,
125
+ args .video_file ,
126
+ fps = 40 ,
127
+ prediction_type = "batch-video" ,
127
128
)
128
129
results = model .poll_until_video_results (job_id )
129
130
with open ("test_video.json" , "w" ) as f :
130
131
json .dump (results , f )
131
132
133
+
132
134
def get_workspace_project_version (args ):
133
135
# api_key = load_roboflow_api_key(args.workspaceId)
134
136
rf = roboflow .Roboflow (args .api_key )
@@ -346,12 +348,13 @@ def _add_workspaces_parser(subparsers):
346
348
)
347
349
workspaceget_parser .set_defaults (func = get_workspace )
348
350
351
+
349
352
def _add_run_video_inference_api_parser (subparsers ):
350
353
run_video_inference_api_parser = subparsers .add_parser (
351
354
"run_video_inference_api" ,
352
355
help = "run video inference api" ,
353
356
)
354
-
357
+
355
358
run_video_inference_api_parser .add_argument (
356
359
"-a" ,
357
360
dest = "api_key" ,
@@ -375,6 +378,7 @@ def _add_run_video_inference_api_parser(subparsers):
375
378
)
376
379
run_video_inference_api_parser .set_defaults (func = run_video_inference_api )
377
380
381
+
378
382
def _add_infer_parser (subparsers ):
379
383
infer_parser = subparsers .add_parser (
380
384
"infer" ,
0 commit comments