Explorar o código

First commit, requirements and adding asr/smt systems

jjorgeDSIC hai 1 mes
pai
achega
8e9c646de0
Modificáronse 4 ficheiros con 98 adicións e 1 borrados
  1. 44 1
      README.md
  2. 26 0
      code/add_asr.py
  3. 23 0
      code/add_smt.py
  4. 5 0
      requirements.txt

+ 44 - 1
README.md

@@ -1,2 +1,45 @@
-# testing_deployment
+# Testing deployment
+
+Preparing environment, requirements:
+
+```
+python3.8 -mvenv env3.8
+source env3.8/bin/activate
+pip install -r requirements.txt
+```
+
+Install MLLP-grpc protos:
+
+```
+source env3.8/bin/activate
+git clone https://mllp.upv.es/git/agimenez/mllp-grpc-protos.git
+cd mllp-grpc-protos
+make
+pip install .
+```
+
+## Test ASR-server
+
+```
+python test_asr_server.py <ASR_SERVER_HOST> <ASR_SERVER_PORT> <WAV>
+```
+
+## Test ASR-system (or Pipeline system)
+
+```
+python test_asr_system.py <ASR_SYSTEM_HOST> <ASR_SYSTEM_PORT> <WAV>
+
+```
+
+## Test SMT-server
+
+```
+python sim_mt_grpc_client.py <SMT_SERVER_HOST> <SMT_SERVER_PORT> <TXT>
+```
+
+## Test SMT-system
+
+```
+python sim_mt_system_grpc_client.py <SMT_SYSTEM_HOST> <SMT_SYSTEM_PORT> <TXT>
+```
 

+ 26 - 0
code/add_asr.py

@@ -0,0 +1,26 @@
+import logging as Log
+import grpc,argparse,time,sys,threading
+
+import mllp_grpc.asr_pb2_grpc as asr_pb2_grpc
+import mllp_grpc.asr_pb2 as asr_pb2
+import mllp_grpc.asr_common_pb2 as asr_common_pb2
+import google.protobuf.empty_pb2 as empty_pb2
+
+from math import ceil
+
+ASR_SERVER_HOST = "localhost"
+ASR_SERVER_PORT = 8041
+ASR_SYSTEM_HOST = "localhost"
+ASR_SYSTEM_PORT = 8042
+
+if __name__=='__main__':
+    Log.basicConfig(level=Log.INFO)
+    addr= '%s:%d'%(ASR_SERVER_HOST, ASR_SERVER_PORT)
+    with grpc.insecure_channel(addr) as channel:
+        stub= asr_pb2_grpc.ASRStub(channel)
+        for info in stub.GetSystemsInfo(empty_pb2.Empty()):
+            print(info)
+        res= stub.AddSystem(asr_pb2.AddSystemRequest(host=ASR_SYSTEM_HOST,
+                                                     port=ASR_SYSTEM_PORT))
+        for info in stub.GetSystemsInfo(empty_pb2.Empty()):
+            print(info)

+ 23 - 0
code/add_smt.py

@@ -0,0 +1,23 @@
+import logging as Log
+import grpc,argparse,time,sys,threading
+
+import mllp_grpc.sim_mt_pb2_grpc as sim_mt_pb2_grpc
+import mllp_grpc.sim_mt_pb2 as sim_mt_pb2
+import mllp_grpc.sim_mt_common_pb2 as sim_mt_common_pb2
+import google.protobuf.empty_pb2 as empty_pb2
+
+SMT_SERVER_HOST = "localhost"
+SMT_SERVER_PORT = 8043
+SMT_SYSTEM_HOST = "localhost"
+SMT_SYSTEM_PORT = 8044
+
+if __name__=='__main__':
+    addr= '%s:%d'%(SMT_SERVER_HOST, SMT_SERVER_PORT)
+    with grpc.insecure_channel(addr) as channel:
+        stub= sim_mt_pb2_grpc.SimMTStub(channel)
+        for info in stub.GetSystemsInfo(empty_pb2.Empty()):
+            print(info)
+        res= stub.AddSystem(sim_mt_pb2.AddSystemRequest(host=SMT_SYSTEM_HOST,
+                                                        port=SMT_SYSTEM_PORT))
+        for info in stub.GetSystemsInfo(empty_pb2.Empty()):
+            print(info)

+ 5 - 0
requirements.txt

@@ -0,0 +1,5 @@
+grpcio==1.27.2
+grpcio-tools==1.27.2
+protobuf==3.11.3
+pydub==0.25.1
+six==1.16.0