Skip to content

Latest commit

 

History

History
91 lines (71 loc) · 1.86 KB

File metadata and controls

91 lines (71 loc) · 1.86 KB

快速入门

本指南将帮助你在5分钟内开始使用本项目。

第一步:启动应用

python test_app.py

看到以下输出表示启动成功:

INFO: Uvicorn running on http://0.0.0.0:8000
INFO: Application startup complete.

第二步:训练模型

  1. 打开浏览器访问 http://localhost:8000/train
  2. 选择"使用项目默认数据"
  3. 点击"开始训练"按钮
  4. 等待5-10分钟,观察训练进度

训练完成后,你会看到模型性能指标。

第三步:进行预测

  1. 访问 http://localhost:8000/predict
  2. 点击"填充示例数据"按钮
  3. 点击"预测"按钮
  4. 查看预测结果

使用API

预测API示例

import requests

# 准备数据
data = {
    "having_IP_Address": 1,
    "URL_Length": 1,
    "Shortining_Service": 1,
    "having_At_Symbol": 1,
    "double_slash_redirecting": 1,
    "Prefix_Suffix": -1,
    "having_Sub_Domain": 1,
    "SSLfinal_State": 1,
    "Domain_registeration_length": 1,
    "Favicon": 1,
    "port": 1,
    "HTTPS_token": 1,
    "Request_URL": 1,
    "URL_of_Anchor": 1,
    "Links_in_tags": 1,
    "SFH": 1,
    "Submitting_to_email": 1,
    "Abnormal_URL": 1,
    "Redirect": 0,
    "on_mouseover": 1,
    "RightClick": 1,
    "popUpWidnow": 1,
    "Iframe": 1,
    "age_of_domain": 1,
    "DNSRecord": 1,
    "web_traffic": 1,
    "Page_Rank": 1,
    "Google_Index": 1,
    "Links_pointing_to_page": 1,
    "Statistical_report": 1
}

# 发送请求
response = requests.post('http://localhost:8000/predict_live', json=data)
result = response.json()

print(f"预测结果: {result['prediction']}")
print(f"原始预测值: {result['raw_prediction']}")

查看API文档

访问 http://localhost:8000/docs 查看完整的API文档。

下一步