mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-12-04 21:03:01 +01:00
22 lines
723 B
Python
22 lines
723 B
Python
|
import os
|
||
|
|
||
|
from khoj.processor.content.images.image_to_entries import ImageToEntries
|
||
|
|
||
|
|
||
|
def test_png_to_jsonl():
|
||
|
with open("tests/data/images/testocr.png", "rb") as f:
|
||
|
image_bytes = f.read()
|
||
|
data = {"tests/data/images/testocr.png": image_bytes}
|
||
|
entries = ImageToEntries.extract_image_entries(image_files=data)
|
||
|
assert len(entries) == 2
|
||
|
assert "opencv-python" in entries[1][0].raw
|
||
|
|
||
|
|
||
|
def test_jpg_to_jsonl():
|
||
|
with open("tests/data/images/nasdaq.jpg", "rb") as f:
|
||
|
image_bytes = f.read()
|
||
|
data = {"tests/data/images/nasdaq.jpg": image_bytes}
|
||
|
entries = ImageToEntries.extract_image_entries(image_files=data)
|
||
|
assert len(entries) == 2
|
||
|
assert "investments" in entries[1][0].raw
|