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
f0cdb539
Commit
f0cdb539
authored
Oct 17, 2021
by
Wijekoon W.M.G.S-IT18130812
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comm
parent
364c99cd
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
167 additions
and
607 deletions
+167
-607
New_FE/client.html
New_FE/client.html
+42
-559
flask_orgiC/app.py
flask_orgiC/app.py
+21
-19
flask_orgiC/imgClassification.h5
flask_orgiC/imgClassification.h5
+0
-0
flask_orgiC/imgClassification.py
flask_orgiC/imgClassification.py
+0
-1
flask_orgiC/templates/client.html
flask_orgiC/templates/client.html
+14
-28
flask_orgiC/templates/resultsPrice.html
flask_orgiC/templates/resultsPrice.html
+90
-0
No files found.
New_FE/client.html
View file @
f0cdb539
This diff is collapsed.
Click to expand it.
flask_orgiC/app.py
View file @
f0cdb539
...
...
@@ -7,7 +7,7 @@ from urllib import request
from
io
import
BytesIO
from
keras_preprocessing
import
image
import
urllib.request
from
datetime
import
date
from
keras.models
import
load_model
import
csv
...
...
@@ -24,36 +24,38 @@ wt = random.randint(380, 490)
@
flask_app
.
route
(
"/"
)
def
Home
():
return
render_template
(
"
predi
.html"
)
return
render_template
(
"
client
.html"
)
@
flask_app
.
route
(
"/classify"
,
methods
=
[
"POST"
])
def
classify
():
image_path
=
"http://192.168.8.103/saved-photo"
print
(
"working.1"
)
image_path
=
"https://static9.depositphotos.com/1628352/1107/i/600/depositphotos_11071200-stock-photo-cabbage.jpg"
class_names
=
[
'banana'
,
'cabbage'
,
'cucumber'
,
'mango'
,
'orange'
,
'tomato'
]
print
(
"working....2"
)
img
=
Image
.
open
(
BytesIO
(
request
.
urlopen
(
image_path
)
.
read
()))
.
resize
((
224
,
224
))
print
(
"working....3"
)
# img = image.load_img(request.urlopen(image_path), target_size=(224,224,3))
x
=
image
.
img_to_array
(
img
)
print
(
"working....4"
)
x
=
np
.
expand_dims
(
x
,
axis
=
0
)
print
(
"working....5"
)
images
=
np
.
vstack
([
x
])
print
(
"working....6"
)
pred
=
model1
.
predict
(
images
,
batch_size
=
6
)
print
(
"working...."
)
label
=
np
.
argmax
(
pred
,
axis
=
1
)
out
=
class_names
[
np
.
argmax
(
pred
)]
print
(
out
)
print
(
"workig"
)
return
render_template
(
"predi.html"
,
prediction_text_class
=
"The flower species is {}"
.
format
(
out
))
return
render_template
(
"predi.html"
,
prediction_text_class
=
out
)
@
flask_app
.
route
(
"/price"
,
methods
=
[
"POST"
])
def
price
():
vegi
=
'banana'
dt
=
'18/10/2021'
today
=
date
.
today
()
dt
=
today
.
strftime
(
"
%
d/
%
m/
%
Y"
)
image_path
=
"https://static9.depositphotos.com/1628352/1107/i/600/depositphotos_11071200-stock-photo-cabbage.jpg"
class_names
=
[
'banana'
,
'cabbage'
,
'cucumber'
,
'mango'
,
'orange'
,
'tomato'
]
img
=
Image
.
open
(
BytesIO
(
request
.
urlopen
(
image_path
)
.
read
()))
.
resize
((
224
,
224
))
# img = image.load_img(request.urlopen(image_path), target_size=(224,224,3))
x
=
image
.
img_to_array
(
img
)
x
=
np
.
expand_dims
(
x
,
axis
=
0
)
images
=
np
.
vstack
([
x
])
pred
=
model1
.
predict
(
images
,
batch_size
=
6
)
label
=
np
.
argmax
(
pred
,
axis
=
1
)
out
=
class_names
[
np
.
argmax
(
pred
)]
with
open
(
'data/Predict_vegetable_2021_SL.csv'
,
encoding
=
"utf8"
)
as
f
:
csv_reader
=
csv
.
DictReader
(
f
)
...
...
@@ -61,14 +63,14 @@ def price():
for
line
in
csv_reader
:
if
line
[
'date'
]
==
dt
and
line
[
'item'
]
==
vegi
:
if
line
[
'date'
]
==
dt
and
line
[
'item'
]
==
out
:
para
=
line
[
'price'
]
print
(
line
[
'price'
])
listM
=
[
vegi
,
dt
,
para
]
return
render_template
(
"
predi.html"
,
vegita
=
vegi
,
dte
=
dt
,
pr
=
para
)
return
render_template
(
"
resultsPrice.html"
,
vegita
=
out
,
dte
=
dt
,
price
=
para
,
weight
=
wt
)
# return render_template("predi.html", prediction_text_class_price="The price is {}".format(para))
if
__name__
==
"__main__"
:
flask_app
.
run
(
debug
=
True
)
\ No newline at end of file
flask_app
.
run
(
debug
=
False
)
\ No newline at end of file
flask_orgiC/imgClassification.h5
View file @
f0cdb539
No preview for this file type
flask_orgiC/imgClassification.py
View file @
f0cdb539
...
...
@@ -66,4 +66,3 @@ history = model.fit(x=train_dataset,
model
.
save
(
'imgClassification.h5'
)
joblib
.
dump
(
model
,
"imgClassmodel.joblib"
)
\ No newline at end of file
flask_orgiC/templates/client.html
View file @
f0cdb539
...
...
@@ -18,14 +18,14 @@
href=
"https://api.mapbox.com/mapbox-gl-js/v2.1.1/mapbox-gl.css"
rel=
"stylesheet"
/>
<link
rel=
"stylesheet"
href=
"/css/style.css"
/>
<link
rel=
"stylesheet"
href=
"/
public/
css/style.css"
/>
<title>
OrgiCheck
</title>
</head>
<body>
<!-- Navbar -->
<nav
class=
"navbar navbar-expand-lg bg-dark navbar-dark py-3 fixed-top"
>
<div
class=
"container"
>
<a
href=
"
#
"
class=
"navbar-brand"
>
OrgiCheck
</a>
<a
href=
"
/
"
class=
"navbar-brand"
>
OrgiCheck
</a>
<button
class=
"navbar-toggler"
...
...
@@ -74,7 +74,7 @@
</div>
<img
class=
"img-fluid w-50 d-none d-sm-block"
src=
"public/img/gopro.png"
src=
"
/
public/img/gopro.png"
alt=
""
/>
</div>
...
...
@@ -102,29 +102,14 @@
<div
class=
"container"
>
<div
class=
"row align-items-center justify-content-between"
>
<div
class=
"col-md"
>
<img
id=
"stream"
src=
"http://192.168.8.103/saved-photo"
class=
"img-fluid"
alt=
""
/>
<!-- <script>
const img = document.querySelector('#stream');
const WS_URL = 'ws:///192.168.8.105:8888';
const ws = new WebSocket(WS_URL);
let urlObject;
ws.onopen = () => console.log(`Connected to ${WS_URL}`);
ws.onmessage = message => {
const arrayBuffer = message.data;
if(urlObject){
URL.revokeObjectURL(urlObject);
}
urlObject = URL.createObjectURL(new Blob([arrayBuffer]));
img.src = urlObject;
}
</script> -->
<img
src=
"https://static9.depositphotos.com/1628352/1107/i/600/depositphotos_11071200-stock-photo-cabbage.jpg"
class=
"img-fluid"
alt=
""
/>
</div>
<div
class=
"col-md p-5"
>
<h2>
Device Connection
</h2>
<p>
Please connect your
<span
class=
"text-warning"
>
OrgiCheck
™
Smart
</span>
with the same network
</p>
<a
href=
"http://192.168.8.103"
class=
"btn btn-light mt-3"
>
<a
href=
"http://192.168.8.103
/
"
class=
"btn btn-light mt-3"
>
<i
class=
"bi bi-camera"
></i>
Retake Image
</a>
</div>
...
...
@@ -214,19 +199,20 @@
</div>
<h3
class=
"card-title mb-3"
>
Price
</h3>
<form
action=
"
/
"
>
<form
action=
"
{{ url_for('price')}}"
method=
"post
"
>
<input
class=
"btn btn-primary"
type=
"file"
id=
"img"
name=
"img"
accept=
"image/*"
>
<br>
<br>
<button
data-bs-toggle=
"modal"
<button
type=
"submit"
data-bs-toggle=
"modal"
data-bs-target=
"#price"
class=
"btn btn-warning"
>
Check with choosed image
</button>
</form>
or
<br>
<button
data-bs-toggle=
"modal"
data-bs-target=
"#price"
class=
"btn btn-success"
>
Check with captured image
</button>
<form
action=
"{{ url_for('price')}}"
method=
"post"
>
<button
type=
"submit"
class=
"btn btn-success"
>
Check with captured image
</button>
</form>
</div>
{{ price }}
</div>
</div>
...
...
@@ -572,13 +558,13 @@
Detected Item:
</label>
<label
class=
"col-form-label"
>
Mango
{{ vegita }}
</label>
</div>
<div
class=
"mb-3"
>
<label
class=
"col-form-label"
>
Approximate Weight:
</label>
<label
class=
"col-form-label"
>
500g
{{ weight }}
</label>
</div>
<div
class=
"mb-3"
>
...
...
@@ -587,7 +573,7 @@
</div>
<div
class=
"mb-3"
>
<label
class=
"col-form-label"
>
Estimated Price:
</label>
<label
class=
"col-form-label"
>
LKR.
40.00
</label>
<label
class=
"col-form-label"
>
LKR.
{{ price }}
</label>
</div>
</form>
</div>
...
...
flask_orgiC/templates/resultsPrice.html
0 → 100644
View file @
f0cdb539
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
/>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
/>
<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>
</head>
<body>
<!-- Navbar -->
<nav
class=
"navbar navbar-expand-lg bg-dark navbar-dark py-3 fixed-top"
>
<div
class=
"container"
>
<a
href=
"/"
class=
"navbar-brand"
>
OrgiCheck
</a>
<button
class=
"navbar-toggler"
type=
"button"
data-bs-toggle=
"collapse"
data-bs-target=
"#navmenu"
>
<span
class=
"navbar-toggler-icon"
></span>
</button>
<div
class=
"collapse navbar-collapse"
id=
"navmenu"
>
<ul
class=
"navbar-nav ms-auto"
>
<li
class=
"nav-item"
>
<a
href=
"#cam"
class=
"nav-link"
>
Device Connection
</a>
</li>
<li
class=
"nav-item"
>
<a
href=
"#team"
class=
"nav-link"
>
Team
</a>
</li>
</ul>
</div>
</div>
</nav>
<br>
<br>
<br>
<br>
<!-- Boxes -->
<section
id=
"check"
class=
"p-5"
>
<div
class=
"container"
>
<div
class=
"row text-center g-4"
>
<div
class=
"col-md"
>
<div
class=
"card bg-dark text-light"
>
<div
class=
"card-body text-center"
>
<div
class=
"h1 mb-3"
>
<i
class=
"bi bi-cash"
></i>
</div>
<h3
class=
"card-title mb-3"
>
Price
</h3>
<p>
{{ vegita }}
</p>
<p>
{{ weight }}
</p>
<p>
{{ price }}
</p>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- 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>
</html>
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