mirror of
https://github.com/ClovertaTheTrilobita/cellpose-web.git
synced 2026-04-01 23:14:50 +00:00
refactor(api): 将后端接口ip配置加入config
This commit is contained in:
parent
9023fefef6
commit
6a02dc595c
3 changed files with 16 additions and 2 deletions
|
|
@ -1,3 +1,7 @@
|
||||||
|
backend:
|
||||||
|
ip: 192.168.193.141
|
||||||
|
port: 5000
|
||||||
|
|
||||||
model:
|
model:
|
||||||
save_dir: models
|
save_dir: models
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@ OUTPUT_DIR = cfg.data.run.output_dir
|
||||||
MODELS_DIR = str((CONFIG_PATH.parent / cfg.model.save_dir).resolve())
|
MODELS_DIR = str((CONFIG_PATH.parent / cfg.model.save_dir).resolve())
|
||||||
TRAIN_DIR = cfg.data.train.train_dir
|
TRAIN_DIR = cfg.data.train.train_dir
|
||||||
TEST_DIR = cfg.data.train.test_dir
|
TEST_DIR = cfg.data.train.test_dir
|
||||||
|
BACKEND_IP = cfg.backend.ip
|
||||||
|
BACKEND_PORT = cfg.backend.port
|
||||||
|
|
||||||
os.makedirs(UPLOAD_DIR, exist_ok=True)
|
os.makedirs(UPLOAD_DIR, exist_ok=True)
|
||||||
executor = ThreadPoolExecutor(max_workers=4)
|
executor = ThreadPoolExecutor(max_workers=4)
|
||||||
|
|
@ -37,7 +39,7 @@ r = redis.Redis(host="127.0.0.1", port=6379, db=0)
|
||||||
|
|
||||||
# 启动测试服务器
|
# 启动测试服务器
|
||||||
def run_dev():
|
def run_dev():
|
||||||
app.run(host="192.168.193.141", port=5000)
|
app.run(host=BACKEND_IP, port=int(BACKEND_PORT))
|
||||||
|
|
||||||
def set_status(task_id, status, **extra):
|
def set_status(task_id, status, **extra):
|
||||||
payload = {"status": status, "updated_at": datetime.datetime.utcnow().isoformat(), **extra}
|
payload = {"status": status, "updated_at": datetime.datetime.utcnow().isoformat(), **extra}
|
||||||
|
|
|
||||||
|
|
@ -1 +1,9 @@
|
||||||
const API_BASE = "http://192.168.193.141:5000/";
|
const config = {
|
||||||
|
server: {
|
||||||
|
protocol: 'http',
|
||||||
|
host: '192.168.193.141',
|
||||||
|
port: 5000
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const API_BASE = `${config.server.protocol}://${config.server.host}:${config.server.port}/`;
|
||||||
Loading…
Reference in a new issue