@@ -124,21 +124,7 @@ def _fetch_remote_ndjson(self, url: str) -> List[Dict[str, Any]]:
124124
125125 @classmethod
126126 def _build_import_predictions_query (cls , file_args : str , vars : str ):
127- cls .validate_cls ()
128- query_str = """mutation createAnnotationImportPyApi($parent_id : ID!, $name: String!, $predictionType : PredictionType!, %s) {
129- createAnnotationImport(data: {
130- %s : $parent_id
131- name: $name
132- %s
133- predictionType: $predictionType
134- }) {
135- __typename
136- ... on ModelAssistedLabelingPredictionImport {%s}
137- ... on ModelErrorAnalysisPredictionImport {%s}
138- }}""" % (vars , cls .id_name , file_args ,
139- query .results_query_part (MALPredictionImport ),
140- query .results_query_part (MEAPredictionImport ))
141- return query_str
127+ raise NotImplementedError ("" )
142128
143129 @classmethod
144130 def validate_cls (cls ):
@@ -182,8 +168,7 @@ def _create_from_url(cls, client, parent_id, name, url):
182168 params = {
183169 "fileUrl" : url ,
184170 "parent_id" : parent_id ,
185- 'name' : name ,
186- 'predictionType' : cls .import_type .value
171+ 'name' : name
187172 })
188173 return cls (client , response ['createAnnotationImport' ])
189174
@@ -215,8 +200,7 @@ def _create_from_bytes(cls, client, parent_id, name, bytes_data,
215200 "file" : None ,
216201 "contentLength" : content_len ,
217202 "parent_id" : parent_id ,
218- "name" : name ,
219- "predictionType" : cls .import_type .value
203+ "name" : name
220204 }
221205 operations = json .dumps ({"variables" : variables , "query" : query_str })
222206 data = {
@@ -226,8 +210,9 @@ def _create_from_bytes(cls, client, parent_id, name, bytes_data,
226210 file_data = (file_name , bytes_data , NDJSON_MIME_TYPE )
227211 files = {file_name : file_data }
228212
229- response = client .execute (data = data , files = files )
230- return cls (client , response ['createAnnotationImport' ])
213+ print (data )
214+ breakpoint ()
215+ return client .execute (data = data , files = files )
231216
232217 @classmethod
233218 def _create_from_objects (cls , client , parent_id , name , predictions ):
@@ -268,14 +253,26 @@ def get_parent_id(self):
268253
269254 @classmethod
270255 def create_from_file (cls , client , model_run_id , name , path ):
271- return cls ._create_from_file (client = client ,
256+ breakpoint ()
257+ return cls (client , cls ._create_from_file (client = client ,
272258 parent_id = model_run_id ,
273259 name = name ,
274- path = path )
260+ path = path )[ 'createModelErrorAnalysisPredictionImport' ])
275261
276262 @classmethod
277263 def create_from_objects (cls , client , model_run_id , name , predictions ):
278- return cls ._create_from_objects (client , model_run_id , name , predictions )
264+ return cls (client , cls ._create_from_objects (client , model_run_id , name , predictions )['createModelErrorAnalysisPredictionImport' ])
265+
266+ @classmethod
267+ def _build_import_predictions_query (cls , file_args : str , vars : str ):
268+ query_str = """mutation createAnnotationImportPyApi($parent_id : ID!, $name: String!, %s) {
269+ createModelErrorAnalysisPredictionImport(data: {
270+ %s : $parent_id
271+ name: $name
272+ %s
273+ }) {%s}
274+ }""" % (vars , cls .id_name , file_args ,query .results_query_part (cls ))
275+ return query_str
279276
280277
281278class MALPredictionImport (AnnotationImport ):
@@ -288,11 +285,26 @@ def get_parent_id(self):
288285
289286 @classmethod
290287 def create_from_file (cls , client , project_id , name , path ):
291- return cls ._create_from_file (client = client ,
288+ return cls ( client , cls ._create_from_file (client = client ,
292289 parent_id = project_id ,
293290 name = name ,
294- path = path )
291+ path = path )[ 'createModelAssistedLabelingPredictionImport' ])
295292
296293 @classmethod
297294 def create_from_objects (cls , client , project_id , name , predictions ):
298- return cls ._create_from_objects (client , project_id , name , predictions )
295+ return cls (client , cls ._create_from_objects (client , project_id , name , predictions )['createModelAssistedLabelingPredictionImport' ])
296+
297+ @classmethod
298+ def _build_import_predictions_query (cls , file_args : str , vars : str ):
299+ query_str = """mutation createAnnotationImportPyApi($parent_id : ID!, $name: String!, %s) {
300+ createModelAssistedLabelingPredictionImport(data: {
301+ %s : $parent_id
302+ name: $name
303+ %s
304+ }) {%s}
305+ }""" % (vars , cls .id_name , file_args ,
306+ query .results_query_part (cls ))
307+ return query_str
308+
309+
310+
0 commit comments