Skip to content

Commit

Permalink
add modelscope example
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Dec 21, 2023
1 parent 554e008 commit 7752760
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions examples/modelscope/captcha.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php
/**
* @link https://modelscope.cn/models/damo/cv_convnextTiny_ocr-recognition-general_damo/summary
*/
$pipeline = PyCore::import('modelscope.pipelines')->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;
1 change: 1 addition & 0 deletions make.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
phpize
./configure
make clean
make -j install

0 comments on commit 7752760

Please sign in to comment.