diff options
author | zhaoyh6 <zhaoyh6@asiainfo.com> | 2022-01-07 15:53:27 +0800 |
---|---|---|
committer | zhaoyh6 <zhaoyh6@asiainfo.com> | 2022-01-07 15:53:50 +0800 |
commit | 4b33938efec63db12b8156db365ef5b56da5f11e (patch) | |
tree | 551724e3c3f2fbad245a81986ab0a782c77fdef4 | |
parent | f3b78cc121a1c2eea89a6ae5d74dcec48d4bafb4 (diff) |
fix:repair checkStyle bug1.0.3
Issue-ID: USECASEUI-605
Signed-off-by: zhaoyh6 <zhaoyh6@asiainfo.com>
Change-Id: Ieb964565f3755e1cac95581347cb48aa80ed6709
-rw-r--r-- | nlp/scripts/api_squad_offline.py | 4 | ||||
-rw-r--r-- | nlp/scripts/upload.py | 10 |
2 files changed, 9 insertions, 5 deletions
diff --git a/nlp/scripts/api_squad_offline.py b/nlp/scripts/api_squad_offline.py index 87b01c4..fe541cd 100644 --- a/nlp/scripts/api_squad_offline.py +++ b/nlp/scripts/api_squad_offline.py @@ -62,7 +62,7 @@ def serving_input_fn(): def main(FLAGS_output_dir, FLAGS_init_checkpoint_squad, FLAGS_export_dir, FLAGS_predict_file=None, FLAGS_train_file=None, FLAGS_do_predict=False, FLAGS_do_train=False, FLAGS_train_batch_size=16, FLAGS_predict_batch_size=8, FLAGS_learning_rate=5e-5, FLAGS_num_train_epochs=3.0, - FLAGS_max_answer_length=100, FLAGS_max_query_length=64, FLAGS_version_2_with_negative=False,questions=[]): + FLAGS_max_answer_length=100, FLAGS_max_query_length=64, FLAGS_version_2_with_negative=False, questions=[]): tf.logging.set_verbosity(tf.logging.INFO) bert_config = modeling.BertConfig.from_json_file(FLAGS_bert_config_file) @@ -226,7 +226,7 @@ class AI2Flask: task = p.submit(main, FLAGS_output_dir, FLAGS_init_checkpoint_squad, FLAGS_export_dir, FLAGS_predict_file, FLAGS_train_file, FLAGS_do_predict, FLAGS_do_train, FLAGS_train_batch_size, FLAGS_predict_batch_size, FLAGS_learning_rate, FLAGS_num_train_epochs, - FLAGS_max_answer_length, FLAGS_max_query_length, FLAGS_version_2_with_negative,questions) + FLAGS_max_answer_length, FLAGS_max_query_length, FLAGS_version_2_with_negative, questions) threads_mapping[task_id] = task return jsonify({"message": "Task submitted successfully", "status": "0"}) diff --git a/nlp/scripts/upload.py b/nlp/scripts/upload.py index abc5610..febf880 100644 --- a/nlp/scripts/upload.py +++ b/nlp/scripts/upload.py @@ -5,7 +5,7 @@ # date = 20210918 -from flask import Flask, request, render_template +from flask import Flask, request import zipfile import shutil import os @@ -13,6 +13,7 @@ import os app = Flask(__name__) app.config['UPLOAD_FOLDER'] = 'upload/' + @app.route("/uploader", methods=["POST"]) def uploader(): print("aa") @@ -22,6 +23,7 @@ def uploader(): f.save(os.path.join(app.config['UPLOAD_FOLDER'], f.filename)) return "ok" + @app.route("/unzipFile/<fileName>", methods=["GET"]) def unzipFile(fileName): zip_file = zipfile.ZipFile(os.path.join(app.config['UPLOAD_FOLDER'], fileName)) @@ -35,6 +37,7 @@ def unzipFile(fileName): zip_file.close() return parentDir + @app.route("/deleteFile/<fileName>", methods=["GET"]) def deleteFile(fileName): path = os.path.join(app.config['UPLOAD_FOLDER'], fileName) @@ -46,6 +49,7 @@ def deleteFile(fileName): return "ok" return "ok" return "error: no such file" - + + if __name__ == '__main__': - app.run(host="0.0.0.0", port=33013)
\ No newline at end of file + app.run(host="0.0.0.0", port=33013) |