Pipeline to JSL_MedS_NER_VLM_v2 (VLM - 2b - q16)

Description

This pretrained pipeline is a built on top of the jsl_meds_ner_vlm_2b_q16_v2 model.

Copy S3 URI

How to use

from sparknlp.pretrained import PretrainedPipeline
from sparknlp_jsl.utils import vision_llm_preprocessor

prompt = """
# Template:
{
  "Patient Name": "string",
  "Patient Age": "integer",
  "Patient Gender": "string",
  "Hospital Number": "string",
  "Episode Number": "string",
  "Episode Date": "date-time"
}
# Context:
<image>
"""

input_df = vision_llm_preprocessor(
    spark=spark,
    images_path="images",
    prompt=prompt,
    output_col_name="prompt"
)

pipeline = PretrainedPipeline("jsl_meds_ner_vlm_2b_q16_v2_pipeline", "en", "clinical/models")
result = pipeline.transform(input_df)
from johnsnowlabs import nlp

prompt = """
# Template:
{
  "Patient Name": "string",
  "Patient Age": "integer",
  "Patient Gender": "string",
  "Hospital Number": "string",
  "Episode Number": "string",
  "Episode Date": "date-time"
}
# Context:
<image>
"""

input_df = nlp.vision_llm_preprocessor(
    spark=spark,
    images_path="images",
    prompt=prompt,
    output_col_name="prompt"
)

pipeline = nlp.PretrainedPipeline("jsl_meds_ner_vlm_2b_q16_v2_pipeline", "en", "clinical/models")
result = pipeline.transform(input_df)
import com.johnsnowlabs.nlp.pretrained.PretrainedPipeline
import com.johnsnowlabs.nlp.util.VisionLLMPreprocessor

val prompt = """
# Template:
{
  "Patient Name": "string",
  "Patient Age": "integer",
  "Patient Gender": "string",
  "Hospital Number": "string",
  "Episode Number": "string",
  "Episode Date": "date-time"
}
# Context:
<image>
"""

val inputDF = VisionLLMPreprocessor(
  spark = spark,
  imagesPath = "images",
  prompt = prompt,
  outputColName = "prompt"
)

val pipeline = new PretrainedPipeline("jsl_meds_ner_vlm_2b_q16_v2_pipeline", "en", "clinical/models")
val result = pipeline.transform(inputDF)

Results

{
    "Patient Name": "Ms RUKHSANA SHAHEEN",
    "Patient Age": 56,
    "Patient Gender": "Female",
    "Hospital Number": "MH005990453",
    "Episode Number": "030000528270",
    "Episode Date": "2021-07-02T08:31:00"
}

Model Information

Model Name: jsl_meds_ner_vlm_2b_q16_v2_pipeline
Type: pipeline
Compatibility: Healthcare NLP 6.1.0+
License: Licensed
Edition: Official
Language: en
Size: 3.5 GB

Included Models

  • DocumentAssembler
  • ImageAssembler
  • MedicalVisionLLM