2 Star 0 Fork 1

Clement Li / dx-predict

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
app.py 1.81 KB
一键复制 编辑 原始数据 按行查看 历史
Clement Li 提交于 2021-08-03 13:21 . fix token
import os
from flask import Flask, request
from label_data.Mindspore_Issue_label_import import Issue_label_input
from data_utils.Mindspore_edge_process import Mindspore_edge_process
from data_utils.Raw_data.New_Old_data_contact import concat_Raw_data, concat_input_data
from data_utils.Mindspore_Aaaignee_one_hot import Mindspore_Assignee_one_hot
from data_utils.Mindspore_Issue_one_hot_process import Mindspore_Issue_one_hot
from data_utils.Raw_data_trans_to_input_data import data_trans_content, data_trans_cites
from src.predict import Predict
app = Flask(__name__)
@app.route('/predict', methods=['POST', 'GET'])
def main():
if request.method == 'POST':
labels_str = request.form['labels']
else:
labels_str = request.args.get('labels')
Issue_label = labels_str.split(",")
# Step1——Data aquirement
Issue_label_input(Issue_label)
issue_itself_path_new = concat_Raw_data() # combine the predict data and default data
# Step2—— Data One-hot
Mindspore_assignee_one_hot_path = Mindspore_Assignee_one_hot(issue_itself_path_new)
Mindspore_issue_one_hot_path = Mindspore_Issue_one_hot(issue_itself_path_new)
Mindspore_edge_path = Mindspore_edge_process(issue_itself_path_new)
# Data process
Mindspore_content_path = concat_input_data(Mindspore_issue_one_hot_path,
Mindspore_assignee_one_hot_path) # 模型输入数据处理
data_trans_content(Mindspore_content_path)
data_trans_cites(Mindspore_edge_path)
# GAT训练
predict_list = Predict(Topn=3) # predict(path, Topn)
pre_str = ",".join(predict_list)
if pre_str == "zhangpanting,MDS_ZHR,shenwei41":
return ""
return pre_str
if __name__ == "__main__":
app.run(debug=True, host='0.0.0.0', port=int(os.environ.get('PORT', 8080)))
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/clement_li/dx-predict.git
git@gitee.com:clement_li/dx-predict.git
clement_li
dx-predict
dx-predict
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891