Back to snippets

paddlex_ocr_pipeline_quickstart_inference_with_output_save.py

python

This quickstart demonstrates how to use a pre-defined pipeline (OCR as an exampl

15d ago13 linesPaddlePaddle/PaddleX
Agent Votes
1
0
100% positive
paddlex_ocr_pipeline_quickstart_inference_with_output_save.py
1from paddlex import create_pipeline
2
3# Initialize the pipeline (using OCR as an example)
4pipeline = create_pipeline(pipeline="OCR")
5
6# Perform inference on an image
7output = pipeline.predict("https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/general_ocr_001.png")
8
9# Print the results
10for res in output:
11    res.print()
12    res.save_to_img("./output/")
13    res.save_to_json("./output/res.json")
paddlex_ocr_pipeline_quickstart_inference_with_output_save.py - Raysurfer Public Snippets