@@ -173,6 +173,40 @@ def export_labels(self, timeout_seconds=60):
173173 self .uid )
174174 time .sleep (sleep_time )
175175
176+ def attach_instructions (self , instructions_file : str ):
177+ """
178+ - Upload a set of instructions for labeling
179+
180+ """
181+ if self .setup_complete is None :
182+ raise Exception ("Cannot attach instructions to a project that has not been setup." )
183+
184+ assert self .setup_complete is not None #Change this to an actual exception...
185+ #Assert that the editor type is the editor..
186+ instructions_url = self .client .upload_file (instructions_file )
187+ lfo = list (self .labeling_frontend_options ())[- 1 ]
188+ customization_options = json .loads (lfo .customization_options )
189+ customization_options ['projectInstructions' ] = instructions_url
190+ option_id = lfo .uid
191+ frontendId = self .labeling_frontend ().uid
192+ args = {"frontendId" : frontendId ,
193+ "name" : "Editor" , #Probably only compatible with the regular editor..
194+ "description" : "Video, image, and text annotation" ,
195+ "optionsId" : option_id ,
196+ "customizationOptions" : json .dumps (customization_options )
197+ }
198+ return self .client .execute ("""
199+ mutation UpdateFrontendWithExistingOptions($frontendId: ID!, $optionsId: ID!, $name: String!, $description: String!, $customizationOptions: String!) {
200+ updateLabelingFrontend(where: {id: $frontendId}, data: {name: $name, description: $description}) {
201+ id
202+ }
203+ updateLabelingFrontendOptions(where: {id: $optionsId}, data: {customizationOptions: $customizationOptions}) {
204+ id
205+ }
206+ }
207+ """ , args )
208+
209+
176210 def labeler_performance (self ):
177211 """ Returns the labeler performances for this Project.
178212
0 commit comments