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 ()
@@ -568,6 +563,7 @@ def call_ollama_llava(messages):
568563 print ("[call_ollama_llava]" )
569564 time .sleep (1 )
570565 try :
566+ model = config .initialize_ollama ()
571567 screenshots_dir = "screenshots"
572568 if not os .path .exists (screenshots_dir ):
573569 os .makedirs (screenshots_dir )
@@ -594,7 +590,7 @@ def call_ollama_llava(messages):
594590 }
595591 messages .append (vision_message )
596592
597- response = ollama .chat (
593+ response = model .chat (
598594 model = "llava" ,
599595 messages = messages ,
600596 )
0 commit comments