Spaces:
Runtime error
Runtime error
Create cli.py
Browse files
cli.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import argparse
|
| 2 |
+
from ai import generate_advice
|
| 3 |
+
from speech import listen, speak_async
|
| 4 |
+
from logger import logger
|
| 5 |
+
|
| 6 |
+
def run_cli():
|
| 7 |
+
parser = argparse.ArgumentParser(description="Tactical AI CLI")
|
| 8 |
+
parser.add_argument("--voice", action="store_true", help="Use voice input/output")
|
| 9 |
+
args = parser.parse_args()
|
| 10 |
+
|
| 11 |
+
while True:
|
| 12 |
+
if args.voice:
|
| 13 |
+
scenario = listen()
|
| 14 |
+
else:
|
| 15 |
+
scenario = input("Enter scenario (or 'quit'): ")
|
| 16 |
+
if not scenario or scenario.lower()=="quit":
|
| 17 |
+
break
|
| 18 |
+
|
| 19 |
+
advice = generate_advice(scenario)
|
| 20 |
+
print(f"Advice: {advice}")
|
| 21 |
+
if args.voice:
|
| 22 |
+
speak_async(advice)
|
| 23 |
+
|
| 24 |
+
if __name__=="__main__":
|
| 25 |
+
run_cli()
|