forked from Open-Speech-EkStep/speech-recognition-nemo-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
24 lines (19 loc) · 748 Bytes
/
server.py
File metadata and controls
24 lines (19 loc) · 748 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from concurrent import futures
import grpc
from src.speech_recognition_service import SpeechRecognizer
from stub.speech_recognition_open_api_pb2_grpc import add_SpeechRecognizerServicer_to_server
from src.utilities import get_env_var
from src.lib.inference_lib import Wav2VecCtc
def run():
workers = int(get_env_var('max_workers', 10))
print('Using server workers:', workers)
server = grpc.server(
futures.ThreadPoolExecutor(max_workers=workers),
# interceptors=(AuthInterceptor('Bearer mysecrettoken'),)
)
add_SpeechRecognizerServicer_to_server(SpeechRecognizer(), server)
server.add_insecure_port('[::]:50051')
server.start()
server.wait_for_termination()
if __name__ == '__main__':
run()