ocr: attach high confidance stuff to all images
All checks were successful
build-and-deploy / build-deploy (push) Successful in 32s
All checks were successful
build-and-deploy / build-deploy (push) Successful in 32s
This commit is contained in:
@@ -56,6 +56,34 @@ class LlamaClient(
|
||||
return post(payload)
|
||||
}
|
||||
|
||||
fun askWithOcr(imageUrl: String, ocrText: String, question: String): String {
|
||||
val payload = mapOf(
|
||||
"model" to "qwen",
|
||||
"temperature" to temperature,
|
||||
"top_p" to topP,
|
||||
"min_p" to minP,
|
||||
"repeat_penalty" to repeatPenalty,
|
||||
"top_k" to topK,
|
||||
"messages" to listOf(
|
||||
mapOf(
|
||||
"role" to "system",
|
||||
"content" to systemPrompt
|
||||
),
|
||||
mapOf(
|
||||
"role" to "user",
|
||||
"content" to listOf(
|
||||
mapOf(
|
||||
"type" to "text",
|
||||
"text" to "${question}\n\nOCR:\n${ocrText}"
|
||||
),
|
||||
mapOf("type" to "image_url", "image_url" to mapOf("url" to imageUrl))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
return post(payload)
|
||||
}
|
||||
|
||||
fun askText(content: String, question: String): String {
|
||||
val payload = mapOf(
|
||||
"model" to "qwen",
|
||||
|
||||
Reference in New Issue
Block a user