Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2022-257
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
2022-257
2022-257
Commits
5fddfd8c
Commit
5fddfd8c
authored
Oct 10, 2022
by
it19048642@my.sllit.lk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated model part
parent
2ff57439
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
5 deletions
+73
-5
ML_Backend/app.py
ML_Backend/app.py
+58
-0
ML_Backend/model/GroceryPredictor.pickle
ML_Backend/model/GroceryPredictor.pickle
+0
-0
bussifinder/src/components/Grocery Input/InputDetails.js
bussifinder/src/components/Grocery Input/InputDetails.js
+15
-5
No files found.
ML_Backend/app.py
View file @
5fddfd8c
...
...
@@ -143,5 +143,63 @@ def pharmacy():
return
jsonify
({
'Error'
:
"Distance to Busstation Missing!"
})
#Grocery
def
predictionGroceryl
(
lst
):
filename
=
'model/GroceryPredictor.pickle'
with
open
(
filename
,
'rb'
)
as
file
:
model
=
pickle
.
load
(
file
)
pred_value
=
model
.
predict
([
lst
])
.
tolist
()
return
pred_value
@
app
.
route
(
'/grocery'
,
methods
=
[
'POST'
,
'GET'
])
def
grocery
():
pred
=
0
if
request
.
method
==
'POST'
:
Trafficflow
=
request
.
json
[
'Trafficflow'
]
Competitors
=
request
.
json
[
'Competitors'
]
Instoreshopping
=
request
.
json
[
'Instoreshopping'
]
Delivery
=
request
.
json
[
'Delivery'
]
Website
=
request
.
json
[
'Website'
]
Sunday
=
request
.
json
[
'Sunday'
]
Monday
=
request
.
json
[
'Monday'
]
Tuesday
=
request
.
json
[
'Tuesday'
]
Wednesday
=
request
.
json
[
'Wednesday'
]
Thursday
=
request
.
json
[
'Thursday'
]
Friday
=
request
.
json
[
'Friday'
]
Saturday
=
request
.
json
[
'Saturday'
]
ParkingArea
=
request
.
json
[
'ParkingArea'
]
if
(
isinstance
(
Trafficflow
,
int
)
and
isinstance
(
Competitors
,
int
)
):
feature_list
=
[]
feature_list
.
append
(
int
(
Trafficflow
))
feature_list
.
append
(
int
(
Competitors
))
feature_list
.
append
(
int
(
Instoreshopping
))
feature_list
.
append
(
int
(
Delivery
))
feature_list
.
append
(
int
(
Website
))
feature_list
.
append
(
int
(
Sunday
))
feature_list
.
append
(
int
(
Monday
))
feature_list
.
append
(
int
(
Tuesday
))
feature_list
.
append
(
int
(
Wednesday
))
feature_list
.
append
(
int
(
Thursday
))
feature_list
.
append
(
int
(
Friday
))
feature_list
.
append
(
int
(
Saturday
))
feature_list
.
append
(
int
(
ParkingArea
))
pred
=
predictionGroceryl
(
feature_list
)
print
(
pred
)
return
jsonify
({
'data'
:
pred
[
0
]})
else
:
if
(
not
isinstance
(
Trafficflow
,
int
)):
return
jsonify
({
'Error'
:
"Traffic flow error!"
})
else
:
return
jsonify
({
'Error'
:
"Compatitor Count error!"
})
if
__name__
==
'__main__'
:
app
.
run
(
debug
=
True
)
\ No newline at end of file
ML_Backend/model/GroceryPredictor.pickle
0 → 100644
View file @
5fddfd8c
File added
bussifinder/src/components/Grocery Input/InputDetails.js
View file @
5fddfd8c
...
...
@@ -99,23 +99,33 @@ export default function InputDetails() {
"
Instoreshopping
"
:
businessDetails
.
value
[
0
].
serviceDetails
.
shopping
?
1
:
0
,
"
Delivery
"
:
businessDetails
.
value
[
0
].
serviceDetails
.
delivery
?
1
:
0
,
"
Website
"
:
businessDetails
.
value
[
0
].
serviceDetails
.
web
?
1
:
0
,
"
ParkingArea
"
:
businessDetails
.
value
[
0
].
serviceDetails
.
parking
?
1
:
0
,
"
Sunday
"
:
businessDetails
.
value
[
0
].
serviceDetails
.
sun
?
1
:
0
,
"
Monday
"
:
businessDetails
.
value
[
0
].
serviceDetails
.
mon
?
1
:
0
,
"
Tuesday
"
:
businessDetails
.
value
[
0
].
serviceDetails
.
tue
?
1
:
0
,
"
Wednesday
"
:
businessDetails
.
value
[
0
].
serviceDetails
.
wedn
?
1
:
0
,
"
Thursday
"
:
businessDetails
.
value
[
0
].
serviceDetails
.
thurs
?
1
:
0
,
"
Friday
"
:
businessDetails
.
value
[
0
].
serviceDetails
.
fri
?
1
:
0
,
"
Saturday
"
:
businessDetails
.
value
[
0
].
serviceDetails
.
sat
?
1
:
0
"
Saturday
"
:
businessDetails
.
value
[
0
].
serviceDetails
.
sat
?
1
:
0
,
"
ParkingArea
"
:
businessDetails
.
value
[
0
].
serviceDetails
.
parking
?
1
:
0
}
axios
.
post
(
'
https://businesspredictor.herokuapp.com/grocery
'
,
groceryModelReq
)
let
locationFeatures
=
{
trafficSum
:
trafficSum
,
competitorsCount
:
competitorsCount
,
}
axios
.
post
(
'
http://127.0.0.1:5000/grocery
'
,
groceryModelReq
)
.
then
(
function
(
GroceryResult
)
{
console
.
log
(
"
Prediction
"
,
GroceryResult
)
console
.
log
(
"
Prediction
"
,
GroceryResult
.
data
)
// dispatch(addBusiness({
// ...businessDetails.value[0], locationFeatures: locationFeatures, ml_result: GroceryResult.data.data
// }))
navigate
(
`/result`
)
handleClose
()
}).
catch
((
error
)
=>
{
console
.
log
(
"
error:
"
,
error
)
})
navigate
(
`/result`
)
}
).
catch
((
error
)
=>
{
...
...
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