remiai3 commited on
Commit
06f0097
·
verified ·
1 Parent(s): 594db23

Upload 4 files

Browse files
Files changed (4) hide show
  1. README.md +32 -0
  2. main.py +16 -0
  3. remiai.png +0 -0
  4. requirements.txt +11 -0
README.md ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # OCR (CPU/GPU)
2
+
3
+ - **Model:** `easyocr` (Apache-2.0)
4
+ - **Task:** Extract text from images. Default language: English.
5
+ - **Note:** Here we just provide the resources for to run this models in the laptops we didn't develop this entire models we just use the open source models for the experiment this model is developed by Jaided AI
6
+
7
+ ## Quick start (any project)
8
+
9
+ ```bash
10
+ # 1) Create env
11
+ python -m venv venv && source .venv/bin/activate # Windows: ./venv/Scripts/activate
12
+
13
+ # 2) Install deps
14
+ pip install -r requirements.txt
15
+
16
+ # 3) Run
17
+ python main.py --help
18
+ ```
19
+
20
+ > Tip: If you have a GPU + CUDA, PyTorch will auto-use it. If not, everything runs on CPU (slower but works).
21
+
22
+ ---
23
+
24
+ here if you face conflicts when downloading the model using main.py then reinstall the library
25
+ **pip install numpy==1.26.4**
26
+
27
+ and while running the main.py code using command then only you the output
28
+ **Use:** python main.py --image remiai.png or python main.py --image sample.jpg
29
+
30
+ other wise you get the output like this
31
+ usage: main.py [-h] --image IMAGE
32
+ error: the following arguments are required: --image
main.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+ import easyocr
3
+ from PIL import Image
4
+
5
+ def main():
6
+ parser = argparse.ArgumentParser()
7
+ parser.add_argument("--image", type=str, required=True)
8
+ args = parser.parse_args()
9
+
10
+ reader = easyocr.Reader(['en'], gpu=False) # force CPU for universality
11
+ result = reader.readtext(args.image, detail=1)
12
+ for bbox, text, conf in result:
13
+ print(f"{text}\t{conf:.3f}")
14
+
15
+ if __name__ == "__main__":
16
+ main()
remiai.png ADDED
requirements.txt ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ torch==2.1.0
2
+ torchvision==0.16.0
3
+ torchaudio==2.1.0
4
+ transformers==4.38.2
5
+ datasets==2.18.0
6
+ Pillow==10.2.0
7
+ numpy==1.26.4
8
+ tqdm==4.66.2
9
+ sentencepiece==0.1.99
10
+ sentence-transformers==2.6.1
11
+ easyocr==1.7.1