()
| 208 | |
| 209 | |
| 210 | def main(): |
| 211 | parser = argparse.ArgumentParser(description="Fun-ASR-Nano Python Client") |
| 212 | parser.add_argument("--server", type=str, default="ws://localhost:10095") |
| 213 | parser.add_argument("--mic", action="store_true", help="Use microphone input") |
| 214 | parser.add_argument("--file", type=str, help="Audio file to transcribe") |
| 215 | parser.add_argument("--hotwords", type=str, default="", help="Hotwords (comma-separated)") |
| 216 | parser.add_argument("--spk", action="store_true", default=True, help="Show speaker IDs") |
| 217 | parser.add_argument("--no-spk", dest="spk", action="store_false") |
| 218 | args = parser.parse_args() |
| 219 | |
| 220 | if not args.mic and not args.file: |
| 221 | parser.error("Specify --mic or --file") |
| 222 | |
| 223 | try: |
| 224 | if args.mic: |
| 225 | asyncio.run(run_mic(args)) |
| 226 | else: |
| 227 | asyncio.run(run_file(args)) |
| 228 | except KeyboardInterrupt: |
| 229 | print(f"\n{RESET}Interrupted.") |
| 230 | |
| 231 | |
| 232 | if __name__ == "__main__": |
no test coverage detected