Add vision-analysis skill; move workaround from TOOLS.md; update log-work-expense to skip image analysis
This commit is contained in:
parent
ac1b4f83f3
commit
9e522fc164
3 changed files with 44 additions and 0 deletions
20
vision-analysis/scripts/analyze.py
Normal file
20
vision-analysis/scripts/analyze.py
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import requests, json, sys, base64
|
||||
|
||||
API_KEY = "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"
|
||||
MODEL = "google/gemini-2.5-flash-lite"
|
||||
|
||||
prompt = sys.argv[1]
|
||||
paths = sys.argv[2:]
|
||||
|
||||
content = [{"type": "text", "text": prompt}]
|
||||
for p in paths:
|
||||
with open(p, "rb") as f:
|
||||
b64 = base64.b64encode(f.read()).decode()
|
||||
content.append({"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{b64}"}})
|
||||
|
||||
resp = requests.post(
|
||||
"https://openrouter.ai/api/v1/chat/completions",
|
||||
headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"},
|
||||
json={"model": MODEL, "messages": [{"role": "user", "content": content}], "max_tokens": 2000}
|
||||
)
|
||||
print(resp.json()["choices"][0]["message"]["content"])
|
||||
Loading…
Add table
Add a link
Reference in a new issue