import requests
import base64
import json

image_path = '/root/.hermes/cache/images/img_668b1b2125b9.jpg'
with open(image_path, 'rb') as f:
    img_b64 = base64.b64encode(f.read()).decode()

# 先用一个通用提示让模型描述整体
resp = requests.post('http://localhost:11434/api/generate', json={
    'model': 'llava-phi3',
    'prompt': 'Describe this image in detail. It appears to be a UI/UX design comparison showing two mobile app screens side by side. Read all text visible in the image, including Chinese characters. What are the screens about? What are the differences between the left and right sides? List every piece of text you can see.',
    'images': [img_b64],
    'stream': False,
    'options': {'num_predict': 2000, 'temperature': 0.2}
}, timeout=300)

result = resp.json()
print(result.get('response', ''))
