|
@@ -45,6 +45,7 @@
|
|
|
<script lang='ts' setup>
|
|
|
import { reactive, ref, toRefs } from 'vue'
|
|
|
import { onMounted } from "vue";
|
|
|
+import { OcrRec } from '../../../../api/api'
|
|
|
|
|
|
let loading = ref(false)
|
|
|
let predictTime = ref(0)
|
|
@@ -90,6 +91,10 @@ const predict = async () => {
|
|
|
}
|
|
|
const img = document.getElementById("raw-img") as HTMLImageElement;
|
|
|
const predictImg = document.getElementById("predict-img") as HTMLImageElement;
|
|
|
+ const inputElement = document
|
|
|
+ .getElementsByClassName("el-input")[0]
|
|
|
+ .getElementsByTagName("input")[0];
|
|
|
+ const file = inputElement.files![0];
|
|
|
|
|
|
loading.value = !loading.value
|
|
|
setTimeout(() => {
|
|
@@ -97,6 +102,16 @@ const predict = async () => {
|
|
|
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>`);
|
|
|
+ // loading.value = !loading.value
|
|
|
+ // })
|
|
|
};
|
|
|
|
|
|
</script>
|