From 7e9d322e39efc9213a610cb210e758ad81938e3f Mon Sep 17 00:00:00 2001 From: Steven Kemp Date: Wed, 16 Sep 2020 21:26:53 -0400 Subject: [PATCH] Add public API to Readme Taken from #frontend discord. Thanks Grant Co-Authored-By: grantw99 --- readme.md | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index e8b5063..7d2b3d9 100644 --- a/readme.md +++ b/readme.md @@ -38,4 +38,67 @@ Open the integrated terminal to run commands in the container. `$ flask run` will start the flask development server and send requests to the flask application. ## Running Unit Tests -Run pytest in the top-level project directory to start unit tests. \ No newline at end of file +Run pytest in the top-level project directory to start unit tests. + +## Public API + +### Solve Image + +**URI**: `/solve-image` + +**Method**: POST + +**Request Body**: + + { + "b64_img": (str) "BASE64ENCODEDIMAGE" + } + +**Response Body**: + + { + "confidence": (number) CONFIDENCE_VALUE_FROM_MATHPIX, + "input_detected": (str) "LATEX_STRING_OF_INPUT_DETECTED_FROM_MATHPIX", + "solved": (str) "LATEX_STRING_OF_CAS_SOLUTION_TO_PROBLEM" + } + +### Solve Latex + +**URI**: `/solve-latex` + +**Method**: POST + +**Request Body**: + + { + "latex": (str) "LATEX_TO_BE_SOLVED" + } + +**Response Body**: + + { + "solved": (str) "LATEX_STRING_OF_CAS_SOLUTION_TO_PROBLEM" + } + +### Mathpix OCR + +**URI**: `/mathpix-ocr` + +**Method**: POST + +**Request Body**: + + { + "b64_img":(str)"BASEBASE64ENCODEDIMAGE" + } + +**Response Body**: + + { + "confidence":(number) CONFIDENCE_VALUE_FROM_MATPHIX, + "confidence_rate":(number) CONFIDENCE_RATE_FROM_MATHPIX, + "latex_styled":(str) "LATEX_STRING_OF_INPUT_DETECTED_FROM_MATHPIX", + "request_id":(str) Doesn't mean anything to us, + "text":(str) Doesnt mean much as we are using latex + } +