From 476dc3f30c014e0d2ebdc46ce0283ddbfe63eeb8 Mon Sep 17 00:00:00 2001
From: VirtuosoQ <2416050435@qq.com>
Date: 星期日, 28 四月 2024 16:37:54 +0800
Subject: [PATCH] 16:37 java_http_client
---
runtime/java_http_client/http/src/main/java/com/example/funasr_java_client/Servcvice/impl/RecognitionServiceImpl.java | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/runtime/java_http_client/http/src/main/java/com/example/funasr_java_client/Servcvice/impl/RecognitionServiceImpl.java b/runtime/java_http_client/http/src/main/java/com/example/funasr_java_client/Servcvice/impl/RecognitionServiceImpl.java
index 1aa6c48..af589a6 100644
--- a/runtime/java_http_client/http/src/main/java/com/example/funasr_java_client/Servcvice/impl/RecognitionServiceImpl.java
+++ b/runtime/java_http_client/http/src/main/java/com/example/funasr_java_client/Servcvice/impl/RecognitionServiceImpl.java
@@ -20,13 +20,20 @@
/**
*
- * @author Virtuoso Qiu
+ * @author Virgil Qiu
* @since 2024/04/24
*
*/
@Service
public class RecognitionServiceImpl implements RecognitionService {
-
+ @Value("${parameters.fileUrl}")
+ private String fileUrl;
+ @Value("${parameters.model}")
+ private String model;
+ @Value("${parameters.hotWords}")
+ private String hotWords;
+ @Value("${parameters.serverIpPort}")
+ private String serverIpPort;
@Override
public Object recognition(MultipartFile file) throws IOException, ExecutionException, InterruptedException {
if (file.isEmpty()) {
@@ -38,7 +45,7 @@
String[] parts = originalFilename.split("\\.");
String prefix = (parts.length > 0) ? parts[0] : originalFilename;
System.out.println(prefix);
- String localFilePath = "E:/EI/Audio" + prefix + ".pcm";
+ String localFilePath = fileUrl + prefix + ".pcm";
File localFile = new File(localFilePath);
@@ -50,17 +57,17 @@
file.transferTo(localFile);
WebSocketClient client = new WebSocketClient();
- URI uri = URI.create("ws://182.40.192.72:10095");
+ URI uri = URI.create(serverIpPort);
StandardWebSocketClient standardWebSocketClient = new StandardWebSocketClient();
WebSocketSession webSocketSession = standardWebSocketClient.execute(client, null, uri).get();
JSONObject configJson = new JSONObject();
- configJson.put("mode", "offline");
+ configJson.put("mode", model);
configJson.put("wav_name", prefix);
configJson.put("wav_format", "pcm"); // 鏂囦欢鏍煎紡涓簆cm
configJson.put("is_speaking", true);
- configJson.put("hotwords", "{\"鑷畾涔塡":20,\"鐑瘝\":20,\"璁剧疆\":30}");
+ configJson.put("hotwords", hotWords");
configJson.put("itn", true);
// 鍙戦�侀厤缃弬鏁颁笌meta淇℃伅
--
Gitblit v1.9.1