mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
fix(vqa): handle Moondream point and detect tasks
Add handlers for "Point at..." and "Detect..." tasks in moondream() that were falling through to answer_question() and failing.
This commit is contained in:
@@ -1111,11 +1111,16 @@ def moondream(question: str, image: Image.Image, repo: str = None, model_name: s
|
||||
response = model.caption(image, length="normal")['caption']
|
||||
elif question == 'MORE DETAILED CAPTION':
|
||||
response = model.caption(image, length="long")['caption']
|
||||
elif question.lower().startswith('point at '):
|
||||
target = question[9:]
|
||||
result = model.point(image, target)
|
||||
response = str(result)
|
||||
elif question.lower().startswith('detect '):
|
||||
target = question[7:]
|
||||
result = model.detect(image, target)
|
||||
response = str(result)
|
||||
else:
|
||||
response = model.answer_question(encoded, question, processor)['answer']
|
||||
# model.detect(image, "face")
|
||||
# model.point(image, "person")
|
||||
# model.detect_gaze(image)
|
||||
return response
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user