Update app.py
Browse files
app.py
CHANGED
|
@@ -28,8 +28,6 @@ def answer_questions(image_tuples, prompt_text):
|
|
| 28 |
|
| 29 |
print(f"image_embeds:\n{image_embeds}\n")
|
| 30 |
print(f"split prompts:\n{prompts}\n")
|
| 31 |
-
|
| 32 |
-
#image_embeds = [moondream.encode_image(img) for img in images]
|
| 33 |
|
| 34 |
answers = moondream.batch_answer(
|
| 35 |
images=image_embeds,
|
|
@@ -37,12 +35,14 @@ def answer_questions(image_tuples, prompt_text):
|
|
| 37 |
tokenizer=tokenizer,
|
| 38 |
)
|
| 39 |
|
|
|
|
| 40 |
for question, answer in zip(prompts, answers):
|
| 41 |
print(f"Q: {question}")
|
| 42 |
print(f"A: {answer}")
|
| 43 |
print()
|
|
|
|
| 44 |
|
| 45 |
-
return
|
| 46 |
|
| 47 |
with gr.Blocks() as demo:
|
| 48 |
gr.Markdown("# π moondream2\nA tiny vision language model. [GitHub](https://github.com/vikhyatk/moondream)")
|
|
|
|
| 28 |
|
| 29 |
print(f"image_embeds:\n{image_embeds}\n")
|
| 30 |
print(f"split prompts:\n{prompts}\n")
|
|
|
|
|
|
|
| 31 |
|
| 32 |
answers = moondream.batch_answer(
|
| 33 |
images=image_embeds,
|
|
|
|
| 35 |
tokenizer=tokenizer,
|
| 36 |
)
|
| 37 |
|
| 38 |
+
result = ""
|
| 39 |
for question, answer in zip(prompts, answers):
|
| 40 |
print(f"Q: {question}")
|
| 41 |
print(f"A: {answer}")
|
| 42 |
print()
|
| 43 |
+
result += (f"Q: {question}\nA: {answer}\n\n")
|
| 44 |
|
| 45 |
+
return result
|
| 46 |
|
| 47 |
with gr.Blocks() as demo:
|
| 48 |
gr.Markdown("# π moondream2\nA tiny vision language model. [GitHub](https://github.com/vikhyatk/moondream)")
|