create an api rest from django project and use it in flutter app

Viewed 32

Hello am new in django and flutter .I'm working in a new project with this technologies and using firebase as a database: actually I have an ocr code in django that recognize the names of medecines :

def ocr_title(im):
image = cv2.imread(im, 0)
img = cv2.resize(image, (500, 500))
img = cv2.GaussianBlur(img, (5, 5), 0)
img = cv2.adaptiveThreshold(img, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 21, 4)
himg, wimg = img.shape
maxw = 0
text = ''
title = pytesseract.image_to_data(img, config='--psm 6 --oem 3')
for x, b in enumerate(title.splitlines()):
    if x != 0:
        b = b.split()
        if len(b) == 12 and len(b[11]) >= 4:

            if (int(b[8]) > maxw):
                maxh = int(b[9])
                maxx = int(b[6])
                maxy = int(b[7])
                maxw = int(b[8])
                text = b[11]
#remove symboles from text
text = re.sub(r'[^\w]', '', text)
text = str(text)
return (text)

so my question is how can I create an API rest from this Django project so I can use these functions in a flutter

0 Answers
Related