INNER CODE UNIT · Python
_ocr_image
codeskyblue/uiautodev · uiautodev/app.py:116
async def _ocr_image(file: UploadFile = File(...)) -> List[Node]:
"""OCR an image"""
image_data = await file.read()
image = convert_bytes_to_image(image_data)
return ocr_image(image)
@app.get("/shutdown")
def shutdown() -> str:
"""Shutdown the server"""
os.kill(os.getpid(), signal.SIGINT)
return "Server shutting down..."
@app.get("/demo")
def demo():
"""Demo endpoint"""
static_dir = Path(__file__).parent / "static"