45 lines
1.0 KiB
Python
45 lines
1.0 KiB
Python
|
#encoding = utf8
|
||
|
import logging
|
||
|
import os
|
||
|
import sys
|
||
|
import time
|
||
|
|
||
|
from human import HumanContext
|
||
|
from utils import config_logging
|
||
|
|
||
|
|
||
|
# try:
|
||
|
# import sounddevice as sd
|
||
|
# except ImportError as e:
|
||
|
# print("Please install sounddevice first. You can use")
|
||
|
# print()
|
||
|
# print(" pip install sounddevice")
|
||
|
# print()
|
||
|
# print("to install it")
|
||
|
# sys.exit(-1)
|
||
|
#
|
||
|
|
||
|
|
||
|
def main():
|
||
|
print("Started! Please speak")
|
||
|
human = HumanContext()
|
||
|
human.build()
|
||
|
time.sleep(60)
|
||
|
print("Stop! ")
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
# devices = sd.query_devices()
|
||
|
# print(devices)
|
||
|
# default_input_device_idx = sd.default.device[0]
|
||
|
# print(f'Use default device: {devices[default_input_device_idx]["name"]}')
|
||
|
|
||
|
current_file_path = os.path.dirname(os.path.abspath(__file__))
|
||
|
log_path = os.path.join(current_file_path, '..', 'logs', 'info.log')
|
||
|
config_logging(log_path, logging.INFO, logging.INFO)
|
||
|
|
||
|
try:
|
||
|
main()
|
||
|
except KeyboardInterrupt:
|
||
|
print("\nCaught Ctrl + C. Exiting")
|