typefile
{
"image": "https://replicate.delivery/pbxt/LU2RNiJHWHYLMvsZZjGktBFFVUB3OYR49mzp20Mln3WNPznP/output.jpg",
"lang": "ch"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_T66**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run hexiaochun/pp-ocr-v4 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"hexiaochun/pp-ocr-v4:28f2a6256ca71b12346fa6be050bdd4a69b51c494da17096745c9377fab911e0",
{
input: {
image: "https://replicate.delivery/pbxt/LU2RNiJHWHYLMvsZZjGktBFFVUB3OYR49mzp20Mln3WNPznP/output.jpg",
lang: "ch"
}
}
);
console.log(output);
To learn more, take a look at the guide on getting started with Node.js.
pip install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_T66**********************************
This is your API token. Keep it to yourself.
import replicate
Run hexiaochun/pp-ocr-v4 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"hexiaochun/pp-ocr-v4:28f2a6256ca71b12346fa6be050bdd4a69b51c494da17096745c9377fab911e0",
input={
"image": "https://replicate.delivery/pbxt/LU2RNiJHWHYLMvsZZjGktBFFVUB3OYR49mzp20Mln3WNPznP/output.jpg",
"lang": "ch"
}
)
print(output)
To learn more, take a look at the guide on getting started with Python.
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_T66**********************************
This is your API token. Keep it to yourself.
Run hexiaochun/pp-ocr-v4 using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
curl -s -X POST \
-H "Authorization: Bearer $REPLICATE_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Prefer: wait" \
-d $'{
"version": "hexiaochun/pp-ocr-v4:28f2a6256ca71b12346fa6be050bdd4a69b51c494da17096745c9377fab911e0",
"input": {
"image": "https://replicate.delivery/pbxt/LU2RNiJHWHYLMvsZZjGktBFFVUB3OYR49mzp20Mln3WNPznP/output.jpg",
"lang": "ch"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "40pvn9wsxnrgy0chegy8jj99a0",
"model": "hexiaochun/pp-ocr-v4",
"version": "28f2a6256ca71b12346fa6be050bdd4a69b51c494da17096745c9377fab911e0",
"input": {
"image": "https://replicate.delivery/pbxt/LU2RNiJHWHYLMvsZZjGktBFFVUB3OYR49mzp20Mln3WNPznP/output.jpg",
"lang": "ch"
},
"logs": "[2024/08/21 09:20:14] ppocr DEBUG: dt_boxes num : 1, elapsed : 0.048467397689819336\n[2024/08/21 09:20:14] ppocr DEBUG: cls num : 1, elapsed : 0.009162425994873047\n[2024/08/21 09:20:14] ppocr DEBUG: rec_res num : 1, elapsed : 0.01996755599975586",
"output": {
"results": [
{
"box": [
[
161,
669
],
[
418,
669
],
[
418,
732
],
[
161,
732
]
],
"confidence": 0.9974066019058228,
"text": "柔软舒适的"
}
]
},
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-08-21T09:20:14.317Z",
"started_at": "2024-08-21T09:20:14.333391Z",
"completed_at": "2024-08-21T09:20:14.677187Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/40pvn9wsxnrgy0chegy8jj99a0/cancel",
"get": "https://api.replicate.com/v1/predictions/40pvn9wsxnrgy0chegy8jj99a0",
"web": "https://replicate.com/p/40pvn9wsxnrgy0chegy8jj99a0"
},
"metrics": {
"predict_time": 0.34379623,
"total_time": 0.360187
}
}