Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ocr-react

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ocr-react - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

src/components/offline-ocr/offlineOcr2.jsx

4

index.js

@@ -6,3 +6,3 @@ /*

* @LastEditTime: 2022-04-21 17:28:03
* @Description:
* @Description:
*/

@@ -12,2 +12,2 @@

export default OfflineOcr
export default OfflineOcr
{
"name": "ocr-react",
"version": "2.0.0",
"version": "2.1.0",
"main": "index.js",

@@ -18,2 +18,3 @@ "license": "MIT",

"@babel/core": "^7.17.5",
"@babel/plugin-transform-runtime": "^7.17.0",
"@babel/preset-env": "^7.16.11",

@@ -20,0 +21,0 @@ "@babel/preset-react": "^7.16.7",

@@ -21,3 +21,3 @@ /*

}
},

@@ -45,2 +45,2 @@ {

module.exports = webpackConfigBase
module.exports = webpackConfigBase
/*
* @Author: Anthony Zhang
* @Date: 2022-03-15 17:03:11
* @LastEditTime: 2022-04-24 16:35:44
* @LastEditTime: 2022-04-29 10:57:54
* @LastEditors: Tianyou

@@ -15,2 +15,4 @@ * @FilePath: \驾照识别\src\components\offline-ocr\offlineOcr.js

const [imgSrc, setSrc] = useState('')
const [result, setResult] = useState([])
useEffect(() => {

@@ -73,9 +75,11 @@ if (navigator.mediaDevices === undefined) {

setSrc(image)
setTimeout(() => {
upload(image)
}, 1000)
}
const upload = () => {
console.log(imgSrc)
const upload = (image) => {
let formData = new FormData()
formData.append('file', imgSrc)
formData.append('file', image)
axios({

@@ -100,2 +104,4 @@ method: 'post',

console.log(res)
setResult(res.data.data)
})

@@ -108,4 +114,24 @@ }

<img src={imgSrc} alt="" />
<button onClick={setImage}>拍照</button>
<button onClick={upload}>上传</button>
<img src="" alt="" id='img1' />
<img src="" alt="" id='img2' />
<button onClick={setImage}>take a picture</button>
{/*<button onClick={upload}>上传</button>*/}
<h2>result</h2>
{
result.map((item, index) => {
return (
<p key={index}>
<span style={{marginRight: '20px'}}>
<span style={{fontWeight:'bold', marginRight: '5px'}}>accuracy:</span>
<span style={{color: 'red'}}>{item.gailv}</span>
</span>
<span>
<span style={{fontWeight:'bold', marginRight: '5px'}}>result:</span>
<span style={{color: 'red'}}>{item.text}</span>
</span>
</p>
)
})
}
</div>

@@ -115,2 +141,2 @@ )

export default OfflineOcr
export default OfflineOcr
/*
* @Author: Anthony Zhang
* @Date: 2022-03-15 17:00:23
* @LastEditTime: 2022-04-22 09:28:36
* @LastEditTime: 2022-05-16 10:25:40
* @LastEditors: Tianyou

@@ -28,2 +28,2 @@ * @FilePath: \驾照识别\src\index.js

<App />, document.getElementById('root')
)
)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc