Skip to content

Commit

Permalink
frontend boilerplate entered
Browse files Browse the repository at this point in the history
  • Loading branch information
soham4abc committed Mar 24, 2022
1 parent ded6be4 commit 52c6a91
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 5 deletions.
9 changes: 5 additions & 4 deletions Backend/API/aapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
class Users(Resource):
# methods go here
def post(self):

parser = reqparse.RequestParser() # initialize

parser.add_argument("data", required=True)
Expand All @@ -30,17 +31,17 @@ def post(self):
data = pd.read_csv(PERMANENT_PATH + "users.csv")
# add the newly provided values
data = data.append(new_data, ignore_index=True)
test2.text_to_image(new_data)
text=test2.text_to_image(new_data)
# save back to CSV
data.to_csv(PERMANENT_PATH + "users.csv", index=False)
return {"data": URL + "/documents/MyFile.docx"}, 200
return {"data": URL + "/documents/MyFile.docx","text":text}, 200

def get(self):

data = pd.read_csv("./users.csv") # read CSV
data = data.to_dict() # convert dataframe to dictionary
return {"data": data}, 200 # return data and 200 OK code
# return {'data': "works"}, 200 # return data and 200 OK code
#return {"data": data}, 200 # return data and 200 OK code
return {'data': "works"}, 200 # return data and 200 OK code

pass

Expand Down
Binary file added Backend/API/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Backend/API/scripts/__pycache__/ocr2.cpython-39.pyc
Binary file not shown.
Binary file modified Backend/API/scripts/__pycache__/test2.cpython-39.pyc
Binary file not shown.
1 change: 1 addition & 0 deletions Backend/API/scripts/ocr2.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def image_to_text(path):

mydoc.add_paragraph(finaltext)
mydoc.save("../../Frontend/documents/MyFile.docx")
return text

cv2.waitKey(0)

Expand Down
3 changes: 2 additions & 1 deletion Backend/API/scripts/test2.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ def text_to_image(datatext):
im = Image.open(BytesIO(base64.b64decode(data)))

im.save("image.png", "PNG")
ocr2.image_to_text("image.png")
text=ocr2.image_to_text("image.png")
return text
3 changes: 3 additions & 0 deletions Backend/API/users.csv

Large diffs are not rendered by default.

0 comments on commit 52c6a91

Please sign in to comment.