class_docstr: App for visualizing predictions in Label Studio results format.
class_docstr_tok: ["App","for","visualizing","predictions","in","Label","Studio","results","format","."]
docstr: Converts predictions to tasks format.
docstr_tok: ["Converts","predictions","to","tasks","format","."]
code: def show_tasks(self, predictions, export_json=None):
      """Converts predictions to tasks format."""
      results = self.show_predictions(predictions)
      data_type = list(self.parameters.data_types)[0]
      meta = {
          "ids": [],
          "data": [],
          "meta": [],
          "max_predictions_id": 0,
          "project": None,
      }
      if export_json:
          fs = get_filesystem(export_json)
          with fs.open(export_json) as f:
              _raw_data = json.load(f)
          for task in _raw_data:
              if results:
                  res = results.pop()
              meta["max_predictions_id"] = (
                  meta["max_predictions_id"] + 1
              )
              temp = {
                  "result": res["result"],
                  "id": meta["max_predictions_id"],
                  "model_version": "",
                  "score": 0.0,
                  "task": task["id"],
              }
              if task.get("predictions"):
                  task["predictions"].append(temp)
              else:
                  task["predictions"] = [temp]
          return _raw_data
  
      print("No export file provided, meta information is generated!")
      final_results = []
      for res in results:
          temp = {
              "result": [res],
              "id": meta["max_predictions_id"],
              "model_version": "",
              "score": 0.0,
              "task": meta["max_predictions_id"],
          }
          task = {
              "id": meta["max_predictions_id"],
              "predictions": [temp],
              "data": {data_type: ""},
              "project": 1,
          }
          meta["max_predictions_id"] = meta["max_predictions_id"] + 1
          final_results.append(task)
      return final_results
  
file_path: lightning-flash/src/flash/core/integrations/labelstudio/visualizer.py
imports: import json
  import random
  import string
  from pytorch_lightning.utilities.cloud_io import get_filesystem
  from flash.core.data.data_module import DataModule
  from flash.core.integrations.labelstudio.input import LabelStudioParameters
label_desc: Use image node_id 3 for calling the App obj's underlying member method code with example usage: obj.show_tasks(predictions, export_json) and returns: final_results, _raw_data