1.執行ollama
ollama pull llama3.2-vision:11b
ollama run llama3.2-vision:11b
2.安裝套件(開啟另一個cmd)
pip install ollama-ocr
3.程式
1 2 3 4 5 6 7 8 9 10 11 | from ollama_ocr import OCRProcessor # Initialize OCR processor ocr = OCRProcessor(model_name='llama3.2-vision:11b') # You can use any vision model available on Ollama # Process an image result = ocr.process_image( image_path="img.png", format_type="markdown" # Options: markdown, text, json, structured, key_value ) print(result) |
執行結果:
沒有留言:
張貼留言