From 7752760db66b9b4fbdc1825e686f7640c19cd37e Mon Sep 17 00:00:00 2001 From: tianfenghan Date: Thu, 21 Dec 2023 19:13:42 +0800 Subject: [PATCH] add modelscope example --- examples/modelscope/captcha.php | 11 +++++++++++ make.sh | 1 + 2 files changed, 12 insertions(+) create mode 100644 examples/modelscope/captcha.php diff --git a/examples/modelscope/captcha.php b/examples/modelscope/captcha.php new file mode 100644 index 0000000..f938188 --- /dev/null +++ b/examples/modelscope/captcha.php @@ -0,0 +1,11 @@ +pipeline; +$Tasks = PyCore::import('modelscope.utils.constant')->Tasks; +// 模型可以换成 xiaolv/ocr_small +$pipe = $pipeline($Tasks->ocr_recognition, model: 'damo/cv_convnextTiny_ocr-recognition-general_damo'); +$file = '/tmp/captcha.png'; +file_put_contents($file, file_get_contents('https://business.swoole.com/page/captcha_register')); +echo '识别结果:' . $pipe($file)['text'][0], PHP_EOL; diff --git a/make.sh b/make.sh index abab022..9718c5f 100755 --- a/make.sh +++ b/make.sh @@ -1,3 +1,4 @@ phpize ./configure +make clean make -j install