Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-010
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
0
Merge Requests
0
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
2021-010
2021-010
Commits
41ffb260
Commit
41ffb260
authored
Oct 18, 2021
by
IT18135862 Wattegedara S. L
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated web application
parent
84890685
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1297 additions
and
0 deletions
+1297
-0
flask_orgiC/Disease_BananaModel_3.ipynb
flask_orgiC/Disease_BananaModel_3.ipynb
+519
-0
flask_orgiC/app.py
flask_orgiC/app.py
+65
-0
flask_orgiC/static/banana disease.jpg
flask_orgiC/static/banana disease.jpg
+0
-0
flask_orgiC/static/healthy (3).jpg
flask_orgiC/static/healthy (3).jpg
+0
-0
flask_orgiC/static/sigatoka_22.jpg
flask_orgiC/static/sigatoka_22.jpg
+0
-0
flask_orgiC/static/sigatoka_37.jpg
flask_orgiC/static/sigatoka_37.jpg
+0
-0
flask_orgiC/templates/disease.html
flask_orgiC/templates/disease.html
+90
-0
flask_orgiC/templates/index.html
flask_orgiC/templates/index.html
+623
-0
No files found.
flask_orgiC/Disease_BananaModel_3.ipynb
0 → 100644
View file @
41ffb260
This diff is collapsed.
Click to expand it.
flask_orgiC/app.py
0 → 100644
View file @
41ffb260
import
os
from
flask
import
Flask
,
request
,
redirect
,
url_for
,
send_from_directory
,
render_template
from
keras.preprocessing.image
import
ImageDataGenerator
,
load_img
,
img_to_array
from
keras.models
import
Sequential
,
load_model
from
werkzeug.utils
import
secure_filename
import
numpy
as
np
ALLOWED_EXTENSIONS
=
set
([
'jpg'
,
'jpeg'
,
'png'
,
'JPG'
])
IMAGE_SIZE
=
(
224
,
224
)
UPLOAD_FOLDER
=
'static'
img2
=
load_model
(
'model/diseases_model3.h5'
)
def
allowed_file
(
filename
):
return
'.'
in
filename
and
\
filename
.
rsplit
(
'.'
,
1
)[
1
]
in
ALLOWED_EXTENSIONS
def
predict
(
file
):
img
=
load_img
(
file
,
target_size
=
IMAGE_SIZE
)
img
=
img_to_array
(
img
)
/
255.0
img
=
np
.
expand_dims
(
img
,
axis
=
0
)
probs
=
img2
.
predict
(
img
)[
0
]
output
=
{
'Healthy'
:
probs
[
0
],
'Sigatoka'
:
probs
[
1
]}
return
output
app
=
Flask
(
__name__
)
app
.
config
[
'UPLOAD_FOLDER'
]
=
UPLOAD_FOLDER
@
app
.
route
(
"/"
)
def
template_test
():
return
render_template
(
'index.html'
,
label
=
''
,
imagesource
=
'file://null'
)
@
app
.
route
(
'/'
,
methods
=
[
'GET'
,
'POST'
])
def
upload_file
():
if
request
.
method
==
'POST'
:
file
=
request
.
files
[
'file'
]
if
file
and
allowed_file
(
file
.
filename
):
filename
=
secure_filename
(
file
.
filename
)
file_path
=
os
.
path
.
join
(
app
.
config
[
'UPLOAD_FOLDER'
],
filename
)
file
.
save
(
file_path
)
output
=
predict
(
file_path
)
return
render_template
(
"disease.html"
,
label
=
output
,
imagesource
=
file_path
)
@
app
.
route
(
'/uploads/<filename>'
)
def
uploaded_file
(
filename
):
return
send_from_directory
(
app
.
config
[
'UPLOAD_FOLDER'
],
filename
)
if
__name__
==
"__main__"
:
app
.
run
(
debug
=
False
,
threaded
=
False
)
flask_orgiC/static/banana disease.jpg
0 → 100644
View file @
41ffb260
5.93 KB
flask_orgiC/static/healthy (3).jpg
0 → 100644
View file @
41ffb260
294 KB
flask_orgiC/static/sigatoka_22.jpg
0 → 100644
View file @
41ffb260
11.2 KB
flask_orgiC/static/sigatoka_37.jpg
0 → 100644
View file @
41ffb260
5.93 KB
flask_orgiC/templates/disease.html
0 → 100644
View file @
41ffb260
<!doctype html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<link
rel=
"stylesheet"
href=
"{{url_for('static',filename='bootstrap.min.css')}}"
>
<link
href=
"https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css"
rel=
"stylesheet"
integrity=
"sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x"
crossorigin=
"anonymous"
/>
<link
rel=
"stylesheet"
href=
"https://cdn.jsdelivr.net/npm/bootstrap-icons@1.3.0/font/bootstrap-icons.css"
/>
<link
href=
"https://api.mapbox.com/mapbox-gl-js/v2.1.1/mapbox-gl.css"
rel=
"stylesheet"
/>
<link
rel=
"stylesheet"
href=
"/public/css/style.css"
/>
<title>
OrgiCheck
</title>
<title>
Disease Recognition Server
</title>
<body
class
style=
"margin:10px;padding:10px"
>
<div
class=
"page-header"
id=
"banner"
>
<div
class=
"row"
>
<div
class=
"col-lg-8 col-md-7 col-sm-6"
>
<h3>
Disease Recognition System
</h3>
</div>
</div>
<!-- <form action="" method=post enctype=multipart/form-data>
<input type=file name=file>
<input type=submit value=Upload>
</form>
-->
</div>
<p
style=
"margin-bottom:2cm;"
></p>
<div
class=
"row"
>
<div
class=
"col-lg-4"
>
<div
class=
"page-header"
>
<h3
id=
"tables"
>
Result
</h3>
</div>
<div
class=
"bs-component"
>
<table
class=
"table table-hover"
>
<tr
class=
"table-active"
>
<!-- <th scope="col">Image</th> -->
<th
scope=
"col"
>
Predict
</th>
</tr>
<tr>
{% if label %}
<th
scope=
"row"
>
<img
width=
"224"
height=
"224"
src=
"{{imagesource}}"
/>
</th>
</tr>
<tr>
<td>
Prediction :
<i>
{{label }}
</i></td>
{% endif %}
</tr>
</table>
</div>
</div>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<!-- Footer -->
<footer
class=
"p-5 bg-dark text-white text-center position-relative"
>
<div
class=
"container"
>
<p
class=
"lead"
>
Copyright
©
2021 OrgiCheck
</p>
<a
href=
"#"
class=
"position-absolute bottom-0 end-0 p-5"
>
<i
class=
"bi bi-arrow-up-circle h1"
></i>
</a>
</div>
</footer>
</body>
\ No newline at end of file
flask_orgiC/templates/index.html
0 → 100644
View file @
41ffb260
This diff is collapsed.
Click to expand it.
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