|
@@ -94,7 +94,7 @@ model = AutoModel(model="E:\\yuyin_model\\Voice_translation", model_revision="v2
|
|
|
# inference_pipeline = pipeline(
|
|
|
# task=Tasks.auto_speech_recognition,
|
|
|
# # model='iic/speech_paraformer-large-vad-punc_asr_nat-zh-cn-16k-common-vocab8404-pytorch',
|
|
|
-# model='C:\\Users\\siwei\\.cache\\modelscope\\hub\\iic\\speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch',
|
|
|
+# model='C:\\Users\\siwei\\.cache\\modelscope\\hub\\iic\\speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch',
|
|
|
# # model="model\punc_ct-transformer_cn-en-common-vocab471067-large",
|
|
|
# model_revision="v2.0.4",
|
|
|
# device='gpu')
|
|
@@ -113,7 +113,7 @@ def route_embed():
|
|
|
|
|
|
if file.filename == '':
|
|
|
return jsonify({"error": "No selected file"}), 400
|
|
|
-
|
|
|
+
|
|
|
embedded = embed(file)
|
|
|
end_time = time.time()
|
|
|
print("Time taken for embedding: ", end_time - start_time)
|
|
@@ -122,7 +122,7 @@ def route_embed():
|
|
|
return jsonify({"message": "File embedded successfully"}), 200
|
|
|
|
|
|
return jsonify({"error": "File embedded unsuccessfully"}), 400
|
|
|
-
|
|
|
+
|
|
|
|
|
|
|
|
|
def route_query(msg):
|
|
@@ -151,9 +151,7 @@ def home():
|
|
|
# 后台接口
|
|
|
|
|
|
|
|
|
-@app.route("/hello")
|
|
|
-def hello():
|
|
|
- return "Hello, World!"
|
|
|
+
|
|
|
|
|
|
|
|
|
#定义需要替换的词
|
|
@@ -192,8 +190,8 @@ def upload_file():
|
|
|
file.save(file_path)
|
|
|
|
|
|
#语音转文字模型1
|
|
|
- res = model.generate(file_path,
|
|
|
- batch_size_s=30,
|
|
|
+ res = model.generate(file_path,
|
|
|
+ batch_size_s=30,
|
|
|
hotword='test')
|
|
|
texts = [item['text'] for item in res]
|
|
|
msg = ' '.join(texts)
|
|
@@ -213,7 +211,7 @@ def upload_file():
|
|
|
for word in words_to_replace:
|
|
|
msg = msg.replace(word, "抱坡")
|
|
|
print(msg)
|
|
|
-
|
|
|
+
|
|
|
|
|
|
return jsonify({"msg": "上传成功",
|
|
|
"code": 200,
|
|
@@ -270,7 +268,7 @@ factors是因子选择
|
|
|
},
|
|
|
]
|
|
|
}
|
|
|
-json中"condition"的值为"gt"、"lt"、"get"、"let"、"between","not_intersect"、"intersect"、"not_contain"、"contain"、"between"
|
|
|
+json中"condition"的值为"gt"、"lt"、"get"、"let"、"between","not_intersect"、"intersect"、"not_contain"、"contain"、"between"
|
|
|
"""
|
|
|
sys_question = """请扮演问答工具,对用户输入信息进行回答,请严格以markdown格式输出并保障寄送格式正确无误"""
|
|
|
# 智能选址
|
|
@@ -372,7 +370,7 @@ def inputMsg():
|
|
|
# if landType != "未找到相关数据" and landType != "" and districtName != "未找到相关数据"and districtName != "":
|
|
|
if landType in land and districtName in addtress:
|
|
|
json_res = jsonResToDict(json_res)
|
|
|
- # print(json_res)
|
|
|
+ # print(json_res)
|
|
|
else:
|
|
|
json_res = "未找到相关数据"
|
|
|
json_res = jsonResToDict_wrong(json_res)
|
|
@@ -390,7 +388,7 @@ def inputMsg():
|
|
|
json_res = update_chat_history_simple(msg)
|
|
|
json_res = jsonResToDict_questions(json_res)
|
|
|
print(json_res) # 打印生成的回复
|
|
|
-
|
|
|
+
|
|
|
# 返回响应
|
|
|
return jsonify(json_res)
|
|
|
|
|
@@ -493,7 +491,7 @@ def jsonResToDict(json_res):
|
|
|
for factor_id, factor_info in input_factors.items():
|
|
|
if factor_id not in added_factor_ids:
|
|
|
res["yxyz"].append(factor_info)
|
|
|
-
|
|
|
+
|
|
|
resObj = {}
|
|
|
resObj["data"] = res
|
|
|
resObj["code"] = 200
|