forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimageDescription.ts
More file actions
35 lines (30 loc) · 1.27 KB
/
Copy pathimageDescription.ts
File metadata and controls
35 lines (30 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { KnownModel, ollamaInference } from "../modules/ollama";
import { groqRequest } from "../modules/groq-llama3";
export async function imageDescription(src: Uint8Array, model: KnownModel = 'moondream:1.8b-v2-fp16'): Promise<string> {
return ollamaInference({
model: model,
messages: [{
role: 'system',
content: 'You are a very advanced model and your task is to describe the image as precisely as possible. Transcribe any text you see.'
}, {
role: 'user',
content: 'Describe the scene',
images: [src],
}]
});
}
export async function llamaFind(question: string, images: string): Promise<string> {
return groqRequest(
`
You are a smart AI that need to read through description of a images and answer user's questions.
This are the provided images:
${images}
DO NOT mention the images, scenes or descriptions in your answer, just answer the question.
DO NOT try to generalize or provide possible scenarios.
ONLY use the information in the description of the images to answer the question.
BE concise and specific.
`
,
question
);
}