2019-07-03 11:56:12 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
import grpc
|
|
|
|
|
from sia.proto import tts_pb2
|
|
|
|
|
from sia.proto import tts_pb2_grpc
|
|
|
|
|
from .tts import player_gen
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def tts_player():
|
|
|
|
|
player = player_gen()
|
2019-07-03 12:40:16 +00:00
|
|
|
channel = grpc.insecure_channel("localhost:50060")
|
2019-07-03 11:56:12 +00:00
|
|
|
stub = tts_pb2_grpc.ServerStub(channel)
|
|
|
|
|
|
|
|
|
|
def play(t):
|
|
|
|
|
test_text = tts_pb2.TextInput(text=t)
|
|
|
|
|
speech = stub.TextToSpeechAPI(test_text)
|
|
|
|
|
player(speech.response)
|
|
|
|
|
|
|
|
|
|
return play
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
|
play = tts_player()
|
2019-07-03 12:40:16 +00:00
|
|
|
play("How may I help you today?")
|
2019-07-03 11:56:12 +00:00
|
|
|
import pdb
|
2019-07-03 12:40:16 +00:00
|
|
|
|
2019-07-03 11:56:12 +00:00
|
|
|
pdb.set_trace()
|
|
|
|
|
|
|
|
|
|
|
2019-07-03 12:40:16 +00:00
|
|
|
if __name__ == "__main__":
|
2019-07-03 11:56:12 +00:00
|
|
|
main()
|