Skip to content

Commit

Permalink
refactor: 代码调整
Browse files Browse the repository at this point in the history
  • Loading branch information
pdx committed Jan 7, 2024
1 parent 9c6c25a commit 60c3b92
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/pages/ocr/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@ export default function Home() {
const parse = useCallback(async (imgSrcUrl: string) => {
setParseText("");
setLoading(true);
const worker = await createWorker({
logger: (m) => console.log(m),
});
await worker.load();
await worker.loadLanguage("eng+chi_sim");
await worker.initialize("eng+chi_sim");
const worker = await createWorker();
const {
data: { text },
} = await worker.recognize(imgSrcUrl);
Expand Down Expand Up @@ -54,7 +49,7 @@ export default function Home() {
<OCRWrapper>
<div className="flex justify-center p-[20px]">
<Button type="primary" loading={loading} onClick={handleClick}>
上传图片解析
{loading ? "正在解析" : "上传图片"}
</Button>
</div>

Expand Down

0 comments on commit 60c3b92

Please sign in to comment.