def test_batch_images_returns_text(self): vision = textindex.VisionApi() texts = vision.detect_text([ "../../data/text/wakeupcat.jpg", "../../data/text/bonito.gif", ]) assert "../../data/text/wakeupcat.jpg" in texts wakeupcat = textindex.extract_description( texts["../../data/text/wakeupcat.jpg"]).lower() assert "wake" in wakeupcat assert "up" in wakeupcat assert "human" in wakeupcat assert "../../data/text/bonito.gif" in texts bonito = textindex.extract_description( texts["../../data/text/bonito.gif"]).lower() assert "bonito" in bonito assert "fermented" in bonito
def test_single_image_returns_text(self): vision = textindex.VisionApi() texts = vision.detect_text(["../../data/text/wakeupcat.jpg"]) assert "../../data/text/wakeupcat.jpg" in texts document = textindex.extract_description( texts["../../data/text/wakeupcat.jpg"]).lower() assert "wake" in document assert "up" in document assert "human" in document