Commit ee1a74a3 authored by 龚子荣's avatar 龚子荣

完成

parent 3e12b938
Pipeline #5551 canceled with stages
FROM python:3.8
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
#!/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
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
# 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()
flask
numpy
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment