def test_vision_analysis_by_image_url(self): api = pyoxford.vision(envs.FILE_PATH) result = api.analyze("https://oxfordportal.blob.core.windows.net/vision/Analysis/4.jpg") self.assertTrue(result.request_id) self.assertTrue(result.adult.isRacyContent) for c in result.categories: print(c.name)
def test_vision_analysis_by_image_url(self): api = pyoxford.vision(envs.FILE_PATH) result = api.analyze( "https://oxfordportal.blob.core.windows.net/vision/Analysis/4.jpg") self.assertTrue(result.request_id) self.assertTrue(result.adult.isRacyContent) for c in result.categories: print(c.name)
def test_vision_analysis_by_image(self): api = pyoxford.vision(envs.FILE_PATH) path = os.path.join(os.path.dirname(__file__), "./data/test_image.jpg") with open(path, "rb") as f: image = f.read() result = api.analyze(image) self.assertTrue(result.request_id) self.assertEqual("jpeg", result.metadata.format.lower())
def test_vision_ocr(self): api = pyoxford.vision(envs.FILE_PATH) result = api.ocr("https://oxfordportal.blob.core.windows.net/vision/OpticalCharacterRecognition/1.jpg") self.assertTrue(result.language) self.assertTrue(len(result.regions) > 0) d = result.to_document() for p in d: print("\n".join(p))
def test_vision_ocr(self): api = pyoxford.vision(envs.FILE_PATH) result = api.ocr( "https://oxfordportal.blob.core.windows.net/vision/OpticalCharacterRecognition/1.jpg" ) self.assertTrue(result.language) self.assertTrue(len(result.regions) > 0) d = result.to_document() for p in d: print("\n".join(p))
import pyoxford api = pyoxford.vision("33b6b29738f340a298a376556fe77a4b") #result = api.ocr("https://oxfordportal.blob.core.windows.net/vision/OpticalCharacterRecognition/1.jpg") #result =api.ocr("https://www.realpython.com/images/blog_images/ocr/ocr.jpg") #result = api.ocr("https://www.realpython.com/images/blog_images/ocr/sample1.jpg") #result = api.ocr("https://www.realpython.com/images/blog_images/ocr/sample2.jpg") #result = api.ocr("https://www.realpython.com/images/blog_images/ocr/sample3.jpg") #result = api.ocr("https://www.realpython.com/images/blog_images/ocr/sample4.jpg") result = api.ocr( "https://www.realpython.com/images/blog_images/ocr/sample5.jpg") doc = result.to_document() for par in doc: print("\n".join(par))
import pyoxford data = open('m.jpg', 'rb').read() api = pyoxford.vision("86a815e8435e43339f254b8c6b6de2f9") #result = api.ocr("https://oxfordportal.blob.core.windows.net/vision/OpticalCharacterRecognition/1.jpg") result = api.ocr(data) doc = result.to_document() for par in doc: print("\n".join(par))