summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeguang He <hekeguang@chinamobile.com>2022-01-31 00:43:56 +0000
committerGerrit Code Review <gerrit@onap.org>2022-01-31 00:43:56 +0000
commit2cd690d6ec131aa9111c0381c1ca76fea33f123f (patch)
treed5637a8faf8ba546f3b7a95ccac96c0bd19b523f
parenta61774297f437b64f62e2ad734cc262fde1c0aa0 (diff)
parent4b33938efec63db12b8156db365ef5b56da5f11e (diff)
Merge "fix:repair checkStyle bug"
-rw-r--r--nlp/scripts/api_squad_offline.py4
-rw-r--r--nlp/scripts/upload.py10
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)