from ollama import generate from config import Config from helpers.image_helper import get_image_bytes import requests system_prompt = Config.SYSTEM_PROMPT def analyze_image_file(image_file, model, user_prompt): # gets image bytes using helper function image_bytes = get_image_bytes(image_file) # API call to remote Ollama server (update with actual URL) url = 'https://5cf5-2401-4900-882d-894-a2-f66f-ba2b-969f.ngrok-free.app ' data = { 'model': model, 'prompt': user_prompt, 'image_bytes': image_bytes } response = requests.post(url, json=data) return response.json() # handles stream response back from LLM def stream_parser(stream): for chunk in stream: yield chunk['response']