Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2020-028
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2020-028
2020-028
Commits
1b195784
Commit
1b195784
authored
Nov 12, 2020
by
Diliru Chamika
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete app.py
parent
78875b9b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
67 deletions
+0
-67
app.py
app.py
+0
-67
No files found.
app.py
deleted
100644 → 0
View file @
78875b9b
from
flask
import
Flask
,
render_template
,
request
from
werkzeug.utils
import
secure_filename
import
cv2
from
PIL
import
Image
import
pytesseract
import
os
import
re
import
joblib
pytesseract
.
pytesseract
.
tesseract_cmd
=
'C://Program Files/Tesseract-OCR/tesseract.exe'
app
=
Flask
(
__name__
)
print
(
"J"
)
@
app
.
route
(
'/'
)
def
index
():
return
render_template
(
'sideeffect.html'
)
@
app
.
route
(
'/prediction'
,
methods
=
[
'POST'
,
'GET'
])
def
prediction
():
diseases
=
{
0
:
"neurofibromatosis"
,
1
:
"carcinoma syndrome"
,
2
:
"von Hippel-Lindau"
,
3
:
"Glioblastoma multiforme"
,
4
:
"tuberous sclerosis"
}
input_data
=
request
.
form
firstname
=
input_data
[
'firstname'
]
lastname
=
input_data
[
'Lastname'
]
age
=
input_data
[
'Age'
]
gender
=
input_data
[
'gender'
]
email
=
input_data
[
'E-mail'
]
f
=
request
.
files
[
'Upload Report'
]
f
.
save
(
secure_filename
(
f
.
filename
))
image
=
cv2
.
imread
(
f
.
filename
)
gray
=
cv2
.
cvtColor
(
image
,
cv2
.
COLOR_BGR2GRAY
)
thresh
=
cv2
.
threshold
(
gray
,
128
,
255
,
cv2
.
THRESH_BINARY
)[
1
]
#thresh = cv2.threshold(gray, 0, 255,cv2.THRESH_BINARY | cv2.THRESH_OTSU)[1]
text
=
pytesseract
.
image_to_string
(
thresh
)
numbers
=
re
.
findall
(
r"[-+]?\d*\.\d+|\d+"
,
text
)
print
(
numbers
,
gender
)
himo
=
float
(
numbers
[
36
])
rbc
=
float
(
numbers
[
37
])
wbc
=
float
(
numbers
[
45
]
+
numbers
[
46
])
neu
=
float
(
numbers
[
47
])
lym
=
float
(
numbers
[
49
])
if
(
gender
==
'male'
):
model
=
joblib
.
load
(
'male.sav'
)
else
:
model
=
joblib
.
load
(
'female.sav'
)
print
([[
himo
,
rbc
,
wbc
,
neu
,
lym
]])
result
=
model
.
predict
([[
himo
,
rbc
,
wbc
,
neu
,
lym
]])[
0
]
disease
=
diseases
[
result
]
return
render_template
(
'result.html'
,
disease
=
disease
)
#{{disease}}
app
.
run
(
debug
=
True
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment