当前位置: 首页 > wzjs >正文

千元低价网站建设物流网站给做软件

千元低价网站建设,物流网站给做软件,成都甲壳虫品牌设计公司,网上购书的网站开发的意义算法/机理模型演示平台搭建(二)—— 算法接口部署(FastApi) 1. 项目结构2. 构建 Docker 镜像3. 运行 Docker 容器4. 访问 API 文档5. 调用 API1. 项目结构 app app/algorithms app/models Dockerfile FROM python:3.9-slimWORKDIR /codeCOPY ./requirements.txt /code…

算法/机理模型演示平台搭建(二)—— 算法接口部署(FastApi)

    • 1. 项目结构
    • 2. 构建 Docker 镜像
    • 3. 运行 Docker 容器
    • 4. 访问 API 文档
    • 5. 调用 API

1. 项目结构

在这里插入图片描述
app
在这里插入图片描述
app/algorithms
在这里插入图片描述
app/models
在这里插入图片描述

Dockerfile

FROM python:3.9-slimWORKDIR /codeCOPY ./requirements.txt /code/requirements.txtRUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir -r requirements.txtCOPY ./app /code/appEXPOSE 8000CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]

源码地址:https://download.csdn.net/download/qq_37128840/90949457

2. 构建 Docker 镜像

在包含 Dockerfile 的项目根目录下,运行以下命令构建镜像:

docker build -t industrial-algorithms-api .

3. 运行 Docker 容器

构建成功后,运行以下命令启动容器:

docker run -d --name industrial-algo-container -p 8000:8000 industrial-algorithms-api
  • -d: 在后台运行容器。
  • --name industrial-algo-container: 为容器指定一个名称。
  • -p 8000:8000: 将主机的 8000 端口映射到容器的 8000 端口。

4. 访问 API 文档

容器运行后,在浏览器中访问 http://localhost:8000/docs (或 http://<你的Docker主机IP>:8000/docs,如果 Docker 不在本地运行)。

你将看到由 FastAPI 自动生成的交互式 API 文档 (Swagger UI),其中列出了所有可用的算法端点、所需的输入参数(请求体)和预期的输出格式(响应体)。

在这里插入图片描述

5. 调用 API

你可以使用 API 文档页面直接发送请求来测试各个算法,或者使用 curlPostman 或其他编程语言(如 Python 的 requests 库)向以下端点发送 POST 或 GET 请求:

  • /algorithms/linear_regression (POST)
  • /algorithms/logistic_regression (POST)
  • /algorithms/decision_tree (POST)
  • /algorithms/svm (POST)
  • /algorithms/knn (POST)
  • /algorithms/kmeans (POST)
  • /algorithms/apriori (POST)
  • /algorithms/cnn_summary (POST) - 获取 CNN 模型摘要
  • /algorithms/fea_explanation (GET) - 获取 FEA 说明
  • /algorithms/meshing_explanation (GET) - 获取 Meshing 说明
  • /algorithms/genetic_algorithm (POST)
  • /algorithms/aco_tsp (POST)
  • /algorithms/pso (POST)
  • /algorithms/interpolation (POST)
  • /algorithms/pid_control (POST)
  • /algorithms/kalman_filter (POST)
  • /algorithms/fft_analysis (POST)
  • /algorithms/naive_bayes (POST) - 新增
  • /algorithms/random_forest (POST) - 新增
  • /algorithms/gradient_boosting (POST) - 新增
  • /algorithms/pca (POST) - 新增
  • /algorithms/svd (POST) - 新增
  • /algorithms/autoencoder (POST) - 新增
  • /algorithms/rnn_lstm (POST) - 新增
  • /algorithms/reinforcement_learning_concept (GET) - 新增
  • /algorithms/anomaly_detection (POST) - 新增
  • /algorithms/fuzzy_logic_concept (GET) - 新增
  • /algorithms/monte_carlo (POST) - 新增
  • /algorithms/simulated_annealing (POST) - 新增
  • /algorithms/bayesian_optimization_concept (GET) - 新增
  • /algorithms/gmm (POST) - 新增
  • /algorithms/arima (POST) - 新增
  • /algorithms/discrete_event_simulation (POST) - 新增
  • /algorithms/agent_based_modeling (POST) - 新增
  • /algorithms/system_dynamics (POST) - 新增

请求体示例:

下面是每个 POST 端点所需请求体的示例 JSON 数据。
请注意,对于 genetic_algorithmpso,API 目前使用固定的示例函数进行优化,请求体主要用于调整算法参数。
对于新增的模拟算法 (DES, ABM, SD),API 实现也是概念性的简化模拟。

  1. /algorithms/linear_regression
    {"x_train": [1, 2, 3, 4, 5],"y_train": [2, 4, 5, 4, 5],"x_predict": [6, 7, 8],"learning_rate": 0.01,"epochs": 1000
    }
    

在这里插入图片描述

  1. /algorithms/logistic_regression

    {"x_train": [1, 2, 3, 6, 7, 8],"y_train": [0, 0, 0, 1, 1, 1],"x_predict": [4, 5],"learning_rate": 0.05,"epochs": 2000,"threshold": 0.5
    }
    
  2. /algorithms/decision_tree

    {"X_train": [[1, 1],[1, 0],[0, 1],[0, 0],[1, 1],[0, 1]],"y_train": [1, 1, 0, 0, 1, 0],"X_predict": [[1, 0],[0, 0]],"max_depth": 2
    }
    
  3. /algorithms/svm

    {"X_train": [[1, 2], [2, 3], [3, 3],[6, 5], [7, 8], [8, 6]],"y_train": [1, 1, 1, -1, -1, -1],"X_predict": [[2, 2],[7, 7]],"learning_rate": 0.001,"epochs": 5000<

文章转载自:

http://08iwHNzJ.tpwzp.cn
http://ZfY8RkIE.tpwzp.cn
http://ecBikXa9.tpwzp.cn
http://ftLTjdEP.tpwzp.cn
http://z02gHCpB.tpwzp.cn
http://VK2DUBMA.tpwzp.cn
http://2YKg0zMc.tpwzp.cn
http://wDDijRIy.tpwzp.cn
http://IaLV8Lpg.tpwzp.cn
http://O9Tw7r9k.tpwzp.cn
http://6LBEyLtl.tpwzp.cn
http://VvHVQaFa.tpwzp.cn
http://SdOkAbiD.tpwzp.cn
http://TPn5uwPg.tpwzp.cn
http://re1ysbl3.tpwzp.cn
http://SvSDC4Wf.tpwzp.cn
http://Yqsl8dk2.tpwzp.cn
http://QB4UyOox.tpwzp.cn
http://H5KV6snz.tpwzp.cn
http://OFJwZmUJ.tpwzp.cn
http://p1jvgIdi.tpwzp.cn
http://gBw0BSbe.tpwzp.cn
http://c6mTGDCF.tpwzp.cn
http://RAG2xGbX.tpwzp.cn
http://Jh53tSWd.tpwzp.cn
http://pmuP4DxW.tpwzp.cn
http://SAK59a79.tpwzp.cn
http://De0NqDdG.tpwzp.cn
http://ZCI36FpP.tpwzp.cn
http://vl8YpDfO.tpwzp.cn
http://www.dtcms.com/wzjs/638816.html

相关文章:

  • 基于 seajs 的高性能网站开发和优化实践_王保平(淘宝)网站建设服务的具体条件
  • 网站建设推广优化有哪些基本方法网页制作题怎么编辑
  • 做外贸通常用哪些网站用什么软件做网站seo好
  • 做家装图接单网站seo怎么读
  • wordpress本地登录windows优化大师怎么使用
  • 常州自助建站seo做网站的越来越少了
  • 建网站教程wordpress有什么选什么用
  • 广西网站洛阳住房和城乡建设厅网站
  • 烤漆 东莞网站建设网站要懂代码
  • 网站描述作用免费oa管理系统
  • gzip压缩 wordpress三亚网站优化
  • 如何访问国外网站做网站可以不买域名和主机吗
  • 小学网站模板免费下载wordpress建站教程jiuyou
  • 网站需求分析的主要内容建e网室内设计网模型楼梯
  • 新浪云sae免费wordpress网站vue网页模板免费
  • 女生做网站后期维护工作好吗高端公司网站
  • 怎么做网站优化排名到前面中国500强排名完整版
  • 指定关键字 网站有更新就提醒食品经营许可网站增项怎么做
  • 盐城专业做网站的公司哪家好互联网装修公司排名
  • 福州免费做网站网上免费自己设计商标
  • wordpress私人建站主题代码素材网站
  • 做网站点子帝国cms网站搬家教程
  • 企业为何要做网站公司邮箱一般用哪种
  • 如何查询网站是谁做的宁波seo排名方案优化
  • 网站怎么做rss订阅功能四川省德阳市建设招投标网站
  • 建购物网站 资质中职国示范建设网站
  • linux做网站教程网站编程基础
  • 网站开发定制合同seo指的是
  • wordpress主题图片怎么换快速优化排名公司推荐
  • 南昌网站seo费用电脑课程培训零基础