Skip to content

Commit 55a0564

Browse files
author
Ubuntu
committed
change python version + server host + start script
1 parent 34d0114 commit 55a0564

File tree

5 files changed

+111
-5
lines changed

5 files changed

+111
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ build
33
dist
44
__pycache__
55
*.pem
6+
server.log

Pipfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ verify_ssl = true
77

88
[packages]
99
flask = "*"
10+
pytesseract = "*"
11+
pillow = "*"
12+
scipy = "*"
1013

1114
[requires]
12-
python_version = "2.7"
15+
python_version = "3.7"

Pipfile.lock

Lines changed: 92 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from inference import *
33
import os
44
import base64
5+
import traceback
56

67
APP_ROOT = os.path.dirname(os.path.abspath(__file__))
78
IMG_OUTPUT_FOLDER = os.path.join(APP_ROOT, 'static')
@@ -38,7 +39,12 @@ def process_image():
3839
img= base64_image
3940
), 200
4041
except Exception as e:
41-
print(e)
42+
print(str(e))
43+
traceback.print_exec()
4244
abort(500)
4345

44-
app.run()
46+
@app.route('/healthcheck', methods=['GET'])
47+
def healthcheck():
48+
return 'success', 200
49+
50+
app.run(host="172.31.27.145", port=5000)

start.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
pipenv shell
4+
nohup python3 server.py > server.log 2>&1 &
5+
6+
echo "PID :: $!"

0 commit comments

Comments
 (0)