@@ -415,7 +415,6 @@ def upsert_instructions(self, instructions_file: str) -> None:
415415 )
416416
417417 frontend = self .labeling_frontend ()
418- frontendId = frontend .uid
419418
420419 if frontend .name != "Editor" :
421420 logger .warning (
@@ -428,35 +427,25 @@ def upsert_instructions(self, instructions_file: str) -> None:
428427 f"instructions_file must be a pdf or html file. Found { instructions_file } "
429428 )
430429
431- lfo = list (self .labeling_frontend_options ())[- 1 ]
432430 instructions_url = self .client .upload_file (instructions_file )
433- customization_options = self .ontology ().normalized
434- customization_options ['projectInstructions' ] = instructions_url
435- option_id = lfo .uid
436-
437- self .client .execute (
438- """mutation UpdateFrontendWithExistingOptionsPyApi (
439- $frontendId: ID!,
440- $optionsId: ID!,
441- $name: String!,
442- $description: String!,
443- $customizationOptions: String!
431+
432+ query_str = """mutation setprojectinsructionsPyApi($projectId: ID!, $instructions_url: String!) {
433+ setProjectInstructions(
434+ where: {id: $projectId},
435+ data: {instructionsUrl: $instructions_url}
444436 ) {
445- updateLabelingFrontend(
446- where: {id: $frontendId},
447- data: {name: $name, description: $description}
448- ) {id}
449- updateLabelingFrontendOptions(
450- where: {id: $optionsId},
451- data: {customizationOptions: $customizationOptions}
452- ) {id}
453- }""" , {
454- "frontendId" : frontendId ,
455- "optionsId" : option_id ,
456- "name" : frontend .name ,
457- "description" : "Video, image, and text annotation" ,
458- "customizationOptions" : json .dumps (customization_options )
459- })
437+ id
438+ ontology {
439+ id
440+ options
441+ }
442+ }
443+ }"""
444+
445+ self .client .execute (query_str , {
446+ 'projectId' : self .uid ,
447+ 'instructions_url' : instructions_url
448+ })
460449
461450 def labeler_performance (self ) -> PaginatedCollection :
462451 """ Returns the labeler performances for this Project.
0 commit comments