Spaces:
Running
Running
| import argparse | |
| from whisper_transcribe import transcribe_file, transcribe_from_mic | |
| from gloss_builder import build_gloss_sequence | |
| from mapping import ASLDictionary | |
| from renderer import stitch_clips | |
| def main(): | |
| parser = argparse.ArgumentParser("Offline ASL Translator CLI") | |
| group = parser.add_mutually_exclusive_group(required=True) | |
| group.add_argument("--text", type=str) | |
| group.add_argument("--file", type=str) | |
| group.add_argument("--mic", action="store_true") | |
| parser.add_argument("--duration", type=int, default=5) | |
| args = parser.parse_args() | |
| if args.text: | |
| transcript = args.text | |
| elif args.file: | |
| transcript = transcribe_file(args.file) | |
| else: | |
| transcript = transcribe_from_mic(args.duration) | |
| print("π Transcript:", transcript) | |
| gloss = build_gloss_sequence(transcript) | |
| print("π€ Gloss tokens:", gloss) | |
| dictionary = ASLDictionary() | |
| paths = dictionary.get_paths(gloss) | |
| print("ποΈ Clip paths:", paths) | |
| if paths: | |
| out = stitch_clips(paths) | |
| print(f"β Video at {out}") | |
| else: | |
| print("β No clips found.") | |
| if __name__ == "__main__": | |
| main() | |