Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2022-089
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
Deshini Perera
2022-089
Commits
db6c091b
Commit
db6c091b
authored
Oct 08, 2022
by
Deshini Perera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parent
9e9dd2c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
api.py
api.py
+27
-0
No files found.
api.py
0 → 100644
View file @
db6c091b
from
flask
import
Flask
,
request
,
url_for
,
redirect
,
render_template
from
flask_cors
import
CORS
import
json
import
LSTM.predictor
as
pr
import
os
app
=
Flask
(
__name__
)
CORS
(
app
)
@
app
.
route
(
'/forecasting'
,
methods
=
[
'GET'
,
'POST'
])
def
forecasting
():
no_of_months
=
int
(
request
.
form
[
'no_of_months'
])
result
=
pr
.
getData
(
no_of_months
)
output_value
=
[]
for
x
in
range
(
len
(
result
)):
output_value
.
append
(
round
(
result
[
x
][
'value'
],
1
))
return_str
=
'{ "Your requested prediction is " : '
+
str
(
output_value
[
0
])
+
' }'
return
json
.
loads
(
return_str
)
if
__name__
==
'__main__'
:
app
.
run
(
host
=
"0.0.0.0"
,
port
=
5000
,
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