Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
numpy_api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
service
numpy_api
Commits
ee1a74a3
Commit
ee1a74a3
authored
Nov 19, 2021
by
龚子荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成
parent
3e12b938
Pipeline
#5551
canceled with stages
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
0 deletions
+81
-0
Dockerfile
Dockerfile
+6
-0
deploy.sh
deploy.sh
+19
-0
docker-compose.yml
docker-compose.yml
+18
-0
main.py
main.py
+36
-0
requirements.txt
requirements.txt
+2
-0
No files found.
Dockerfile
0 → 100644
View file @
ee1a74a3
FROM
python:3.8
WORKDIR
/usr/src/app
COPY
requirements.txt ./
RUN
pip
install
--no-cache-dir
-r
requirements.txt
deploy.sh
0 → 100644
View file @
ee1a74a3
#!/usr/bin/env bash
basepath
=
$(
cd
`
dirname
$0
`
;
pwd
)
;
cd
${
basepath
}
;
function
deploy
()
{
Compose
=
"docker-compose -f docker-compose.yml"
eval
"docker-compose restart"
}
echo
"--- git pull ---"
;
git pull
;
echo
"--- deploy ---"
;
deploy
;
echo
"--- finish deploy ---"
;
\ No newline at end of file
docker-compose.yml
0 → 100644
View file @
ee1a74a3
version
:
"
3"
services
:
app
:
image
:
register.chillcy.com/images/python:python3.8-numpy-flask
ports
:
-
5000:5000
working_dir
:
/root/numpy_api
volumes
:
-
./:/root/numpy_api
restart
:
always
command
:
-
python3
-
/root/numpy_api/main.py
logging
:
driver
:
"
json-file"
options
:
max-size
:
"
1g"
\ No newline at end of file
main.py
0 → 100644
View file @
ee1a74a3
# This is a sample Python script.
# Press ⌃R to execute it or replace it with your code.
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.
import
numpy
from
flask
import
Flask
app
=
Flask
(
__name__
)
@
app
.
route
(
"/<_x>/<_y>"
)
def
hello_world
(
_x
,
_y
):
_sx
=
_x
.
split
(
","
)
_sy
=
_y
.
split
(
","
)
_fy
=
[]
_fx
=
[]
for
item
in
_sx
:
_fx
.
append
(
float
(
item
))
for
item
in
_sy
:
_fy
.
append
(
float
(
item
))
x
=
numpy
.
array
(
_fx
)
y
=
numpy
.
array
(
_fy
)
a
,
b
=
numpy
.
polyfit
(
numpy
.
log
(
x
),
y
,
1
)
return
{
"a"
:
a
,
"b"
:
b
}
if
__name__
==
'__main__'
:
app
.
run
()
requirements.txt
0 → 100644
View file @
ee1a74a3
flask
numpy
\ 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