omvishesh commited on
Commit
fa51bca
·
verified ·
1 Parent(s): ad5bde0

Delete ocr-2-0-demo.ipynb

Browse files
Files changed (1) hide show
  1. ocr-2-0-demo.ipynb +0 -1
ocr-2-0-demo.ipynb DELETED
@@ -1 +0,0 @@
1
- {"cells":[{"cell_type":"code","execution_count":4,"metadata":{"execution":{"iopub.execute_input":"2024-09-15T14:16:51.329114Z","iopub.status.busy":"2024-09-15T14:16:51.328719Z","iopub.status.idle":"2024-09-15T14:17:05.901068Z","shell.execute_reply":"2024-09-15T14:17:05.899711Z","shell.execute_reply.started":"2024-09-15T14:16:51.329076Z"},"trusted":true},"outputs":[],"source":["\n"," "]},{"cell_type":"code","execution_count":1,"metadata":{},"outputs":[{"name":"stdout","output_type":"stream","text":["True\n"]}],"source":["import torch\n","print(torch.cuda.is_available())\n"]},{"cell_type":"code","execution_count":2,"metadata":{"_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","execution":{"iopub.execute_input":"2024-09-15T14:17:09.095622Z","iopub.status.busy":"2024-09-15T14:17:09.095169Z","iopub.status.idle":"2024-09-15T14:17:22.621111Z","shell.execute_reply":"2024-09-15T14:17:22.619916Z","shell.execute_reply.started":"2024-09-15T14:17:09.095579Z"},"trusted":true},"outputs":[{"data":{"application/vnd.jupyter.widget-view+json":{"model_id":"ec79ce9786ed4a8eb91296e2c346af06","version_major":2,"version_minor":0},"text/plain":["generation_config.json: 0%| | 0.00/117 [00:00<?, ?B/s]"]},"metadata":{},"output_type":"display_data"}],"source":["from transformers import AutoModel, AutoTokenizer\n","\n","tokenizer = AutoTokenizer.from_pretrained('ucaslcl/GOT-OCR2_0', trust_remote_code=True)\n","model = AutoModel.from_pretrained('ucaslcl/GOT-OCR2_0', trust_remote_code=True, low_cpu_mem_usage=True, device_map='cuda', use_safetensors=True, pad_token_id=tokenizer.eos_token_id)\n","model = model.eval().cuda()"]},{"cell_type":"code","execution_count":9,"metadata":{"execution":{"iopub.execute_input":"2024-09-15T14:43:22.165622Z","iopub.status.busy":"2024-09-15T14:43:22.165205Z","iopub.status.idle":"2024-09-15T14:43:23.216273Z","shell.execute_reply":"2024-09-15T14:43:23.215076Z","shell.execute_reply.started":"2024-09-15T14:43:22.165582Z"},"trusted":true},"outputs":[{"name":"stdout","output_type":"stream","text":[" Volume in drive E is New Volume\n"," Volume Serial Number is 5875-9278\n","\n"," Directory of E:\\Programming\\Machine Learning\n","\n","25-09-2024 21:39 <DIR> .\n","20-09-2024 22:17 <DIR> ..\n","26-09-2024 15:59 <DIR> .byaldi\n","19-09-2024 00:31 <DIR> __pycache__\n","16-06-2024 17:44 723,380 ASL.ipynb\n","01-07-2024 09:45 2,796 cg.py\n","14-07-2024 23:33 2,530 cgsem.py\n","16-06-2024 15:16 5,438 collectdata.py\n","26-09-2024 16:05 3,695,886 ColPali_+_Qwen2_VL.ipynb\n","18-06-2024 01:30 46,583 confusion matrix.png\n","16-06-2024 14:15 75,226 costfu.ipynb\n","22-06-2024 11:35 3,191 hello.py\n","19-03-2024 20:13 7,872,723 Holi Meetup_page-0001.jpg\n","16-06-2024 14:14 49,432 ISL.ipynb\n","14-08-2024 00:09 914 jarvis.py\n","18-09-2024 22:05 1,664 livesign.py\n","18-09-2024 21:42 8,046 livesignlang.ipynb\n","19-07-2024 10:47 1,151 mode.py\n","16-06-2024 15:34 0 model.h5\n","18-09-2024 20:14 <DIR> myenv\n","22-09-2024 01:06 15 new.py\n","26-09-2024 16:07 25,817 ocr-2-0-demo.ipynb\n","18-09-2024 20:14 <DIR> python\n","19-07-2024 11:37 1,637 random_images.py\n","16-06-2024 15:13 1,341 realtimedetection.py\n","16-07-2024 03:55 1,046 rename.py\n","18-06-2024 02:21 560,061 sample.png\n","13-07-2024 13:38 841,916 sign_language11.ipynb\n","18-09-2024 20:14 <DIR> SignImage48x48\n","18-09-2024 21:35 101,041,520 signlanguagetest.h5\n","18-09-2024 21:36 1,136,906 signlanguagetest.ipynb\n","16-06-2024 15:13 103 split.py\n","22-09-2024 14:43 <DIR> stanford ML\n","19-09-2024 00:31 166 test.py\n","16-06-2024 15:30 8,998,728 trainmodel.ipynb\n"," 27 File(s) 125,098,216 bytes\n"," 8 Dir(s) 27,865,268,224 bytes free\n"]}],"source":["%ls \"E:/Programming/Machine Learning/\"\n"]},{"cell_type":"code","execution_count":10,"metadata":{"execution":{"iopub.execute_input":"2024-09-15T14:43:23.772585Z","iopub.status.busy":"2024-09-15T14:43:23.772190Z","iopub.status.idle":"2024-09-15T14:43:23.777505Z","shell.execute_reply":"2024-09-15T14:43:23.776605Z","shell.execute_reply.started":"2024-09-15T14:43:23.772549Z"},"trusted":true},"outputs":[],"source":["import warnings \n","warnings.filterwarnings(\"ignore\")"]},{"cell_type":"markdown","metadata":{},"source":["# OCR"]},{"cell_type":"code","execution_count":15,"metadata":{"execution":{"iopub.execute_input":"2024-09-15T14:43:32.566177Z","iopub.status.busy":"2024-09-15T14:43:32.565288Z","iopub.status.idle":"2024-09-15T14:43:57.005256Z","shell.execute_reply":"2024-09-15T14:43:57.004278Z","shell.execute_reply.started":"2024-09-15T14:43:32.566135Z"},"trusted":true},"outputs":[{"name":"stderr","output_type":"stream","text":["The attention mask and the pad token id were not set. As a consequence, you may observe unexpected behavior. Please pass your input's `attention_mask` to obtain reliable results.\n","Setting `pad_token_id` to `eos_token_id`:None for open-end generation.\n"]},{"name":"stdout","output_type":"stream","text":["Central University of Jharkhand\n","(Established by an Act of Parliament of India,2009)\n","Date: 09 September 2024\n","Sub: Smart India Hackathon 2024 – Nomination\n","I am pleased to nominate the below team from our college to participate in Smart India Hackathon 2024. AICTE Application No for\n","our college is 1-4764525701\n","Team: Polymorphs\n","Name\n","Gender\n","(M/F)\n","Email id\n","Mobile no.\n","Stream\n","Year\n","Team Leader\n","OM VISHESH\n","M\n","[email protected]\n","n\n","9523218778\n","CSE\n","3rd\n","Team Member\n","SOUMYA NAYAK\n","RANJAN\n","M\n","soumya.22190503058@cuj\n","l.ac.in\n","6371903382\n","CSE\n","3rd\n","Team Member\n","RAVINANDAN SAMRAT\n","M\n","ravinandan.22190503044\n","@cuj.ac.in\n","6205147343\n","CSE\n","3rd\n","Team Member\n","KUMAR ARYAN\n","M\n","kumar.22190503028@cuj\n","ac.in\n","7989845752\n","CSE\n","3rd\n","Team Member\n","BAIHAV KUMAR\n","CHANDRA\n","M\n","baibhav.22190503017@cuj\n","ac.in\n","9835505852\n","CSE\n","3rd\n","Team Member\n","AYESHA GUPTA\n","F\n","ayesha.22190503015@cuj\n","ac.in\n","9508546494\n","CSE\n","3rd\n","Mentor 1\n","(Optional)\n","Dr. Pushpendra Kumar\n","M\n","[email protected]\n","7209164998\n","CSE\n","Mentor 2\n","(Optional)\n","Dr. Kanojia Sindhuben\n","Babulal\n","F\n","drkanj@[email protected]\n","9415800952\n","CSE\n","Sincerely,\n","SPOC\n","Central University of Jharkhand, Ranchi.\n"]}],"source":["# input your test image\n","path= \"E:/Programming/Machine Learning/\"\n","image_file = \"E:\\\\Programming\\\\Machine Learning\\\\om (2)_page-0001.jpg\"\n","# plain texts OCR\n","res = model.chat(tokenizer, image_file, ocr_type='ocr')\n","print(res)"]}],"metadata":{"kaggle":{"accelerator":"nvidiaTeslaT4","dataSources":[{"datasetId":5708585,"sourceId":9403358,"sourceType":"datasetVersion"},{"datasetId":5708721,"sourceId":9403512,"sourceType":"datasetVersion"},{"datasetId":5708834,"sourceId":9403655,"sourceType":"datasetVersion"}],"dockerImageVersionId":30762,"isGpuEnabled":true,"isInternetEnabled":true,"language":"python","sourceType":"notebook"},"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.11.4"}},"nbformat":4,"nbformat_minor":4}