Hi ! dictionaries are supported as long as they have the same keys.
Otherwise the missing keys are attributed a value of None.
In your case since you only keep certain labels depending on the scores, you can instead use lists:
final_output["labels"] = [label for label, score in zip(output['labels'], output['scores']) if score > threshold]
final_output["scores"] = [score for score in output['scores'] if score > threshold]