|
@@ -97,21 +97,21 @@ const predict = async () => {
|
|
|
const file = inputElement.files![0];
|
|
|
|
|
|
loading.value = !loading.value
|
|
|
- setTimeout(() => {
|
|
|
- loading.value = !loading.value
|
|
|
- predictImg.src = "https://cdn.pixabay.com/photo/2021/03/14/18/03/cat-6095007_1280.jpg"
|
|
|
- predictTime.value = Math.ceil(Math.random() * 10);
|
|
|
- }, 2000);
|
|
|
-
|
|
|
- // OcrRec({
|
|
|
- // image: file,
|
|
|
- // }).then(res => {
|
|
|
- // console.log(res.code)
|
|
|
- // predictImg.src = res.image
|
|
|
- // predictTime.value = res.costTime
|
|
|
- // result.value = res.text.reduce((total, cur) => total + `<p>${cur}</p>`);
|
|
|
+ // setTimeout(() => {
|
|
|
// loading.value = !loading.value
|
|
|
- // })
|
|
|
+ // predictImg.src = "https://cdn.pixabay.com/photo/2021/03/14/18/03/cat-6095007_1280.jpg"
|
|
|
+ // predictTime.value = Math.ceil(Math.random() * 10);
|
|
|
+ // }, 2000);
|
|
|
+
|
|
|
+ OcrRec({
|
|
|
+ image: file,
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res.code)
|
|
|
+ predictImg.src = res.data.image
|
|
|
+ predictTime.value = res.costTime
|
|
|
+ result.value = res.data.text.reduce((total, cur) => total + `<p>${cur}</p>`);
|
|
|
+ loading.value = !loading.value
|
|
|
+ })
|
|
|
};
|
|
|
|
|
|
</script>
|