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/RecognitionServiceImpl2.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/RecognitionServiceImpl2.java b/runtime/java_http_client/http/src/main/java/com/example/funasr_java_client/Servcvice/impl/RecognitionServiceImpl2.java
index 4748a4e..4cbdafa 100644
--- a/runtime/java_http_client/http/src/main/java/com/example/funasr_java_client/Servcvice/impl/RecognitionServiceImpl2.java
+++ b/runtime/java_http_client/http/src/main/java/com/example/funasr_java_client/Servcvice/impl/RecognitionServiceImpl2.java
@@ -23,14 +23,21 @@
 
 /**
  *
- * @author Virtuoso Qiu
+ * @author Virgil Qiu
  * @since 2024/04/24
  *
  */
 
 @Service
 public class RecognitionServiceImpl2 implements RecognitionService2 {
-
+    @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()) {
@@ -42,7 +49,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);
 
@@ -54,17 +61,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