1+ import base64
2+ import io
3+ import json
14import os
25import time
3- import json
4- import base64
56import traceback
6- import io
7+
78import easyocr
89import ollama
9-
10+ import pkg_resources
1011from PIL import Image
1112from ultralytics import YOLO
1213
1314from operate .config import Config
1415from operate .exceptions import ModelNotRecognizedException
15- from operate .utils .screenshot import (
16- capture_screen_with_cursor ,
17- )
1816from operate .models .prompts import (
17+ get_system_prompt ,
1918 get_user_first_message_prompt ,
2019 get_user_prompt ,
21- get_system_prompt ,
2220)
23- from operate .utils .ocr import get_text_element , get_text_coordinates
24-
25-
2621from operate .utils .label import (
2722 add_labels ,
2823 get_click_position_in_percent ,
2924 get_label_coordinates ,
3025)
31- from operate .utils .style import ANSI_GREEN , ANSI_RED , ANSI_RESET , ANSI_BRIGHT_MAGENTA
32- import pkg_resources
33-
26+ from operate .utils .ocr import get_text_coordinates , get_text_element
27+ from operate . utils . screenshot import capture_screen_with_cursor
28+ from operate . utils . style import ANSI_BRIGHT_MAGENTA , ANSI_GREEN , ANSI_RED , ANSI_RESET
3429
3530# Load configuration
3631config = Config ()
@@ -456,6 +451,7 @@ def call_ollama_llava(messages):
456451 print ("[call_ollama_llava]" )
457452 time .sleep (1 )
458453 try :
454+ model = config .initialize_ollama ()
459455 screenshots_dir = "screenshots"
460456 if not os .path .exists (screenshots_dir ):
461457 os .makedirs (screenshots_dir )
@@ -482,7 +478,7 @@ def call_ollama_llava(messages):
482478 }
483479 messages .append (vision_message )
484480
485- response = ollama .chat (
481+ response = model .chat (
486482 model = "llava" ,
487483 messages = messages ,
488484 )
0 commit comments