@@ -124,21 +124,7 @@ def _fetch_remote_ndjson(self, url: str) -> List[Dict[str, Any]]:
124
124
125
125
@classmethod
126
126
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 ("" )
142
128
143
129
@classmethod
144
130
def validate_cls (cls ):
@@ -182,8 +168,7 @@ def _create_from_url(cls, client, parent_id, name, url):
182
168
params = {
183
169
"fileUrl" : url ,
184
170
"parent_id" : parent_id ,
185
- 'name' : name ,
186
- 'predictionType' : cls .import_type .value
171
+ 'name' : name
187
172
})
188
173
return cls (client , response ['createAnnotationImport' ])
189
174
@@ -215,8 +200,7 @@ def _create_from_bytes(cls, client, parent_id, name, bytes_data,
215
200
"file" : None ,
216
201
"contentLength" : content_len ,
217
202
"parent_id" : parent_id ,
218
- "name" : name ,
219
- "predictionType" : cls .import_type .value
203
+ "name" : name
220
204
}
221
205
operations = json .dumps ({"variables" : variables , "query" : query_str })
222
206
data = {
@@ -226,8 +210,9 @@ def _create_from_bytes(cls, client, parent_id, name, bytes_data,
226
210
file_data = (file_name , bytes_data , NDJSON_MIME_TYPE )
227
211
files = {file_name : file_data }
228
212
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 )
231
216
232
217
@classmethod
233
218
def _create_from_objects (cls , client , parent_id , name , predictions ):
@@ -268,14 +253,26 @@ def get_parent_id(self):
268
253
269
254
@classmethod
270
255
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 ,
272
258
parent_id = model_run_id ,
273
259
name = name ,
274
- path = path )
260
+ path = path )[ 'createModelErrorAnalysisPredictionImport' ])
275
261
276
262
@classmethod
277
263
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
279
276
280
277
281
278
class MALPredictionImport (AnnotationImport ):
@@ -288,11 +285,26 @@ def get_parent_id(self):
288
285
289
286
@classmethod
290
287
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 ,
292
289
parent_id = project_id ,
293
290
name = name ,
294
- path = path )
291
+ path = path )[ 'createModelAssistedLabelingPredictionImport' ])
295
292
296
293
@classmethod
297
294
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