| import os |
| import subprocess |
| import requests |
| from datetime import datetime |
|
|
| |
| COLAB_URL = "https://56a0-35-197-74-67.ngrok-free.app/chat" |
| MODEL_PATH = "/data/data/com.termux/files/home/jarvis/voice/en_US-amy-medium.onnx" |
| PIPER_BIN = "/data/data/com.termux/files/home/jarvis/voice/bin/piper" |
| OUT_FILE = "/data/data/com.termux/files/home/jarvis/voice/out.wav" |
|
|
| def speak(text): |
| print(f"JARVIS: {text}") |
| os.system(f"proot-distro login debian -- {PIPER_BIN} --model {MODEL_PATH} --output_file {OUT_FILE} << 'EOF'\n{text}\nEOF") |
| os.system(f"termux-media-player play {OUT_FILE}") |
|
|
| def open_app(app_name): |
| """Automatically searches and opens any app on your Realme 7.""" |
| target = app_name.lower().strip() |
| |
| |
| fast_list = { |
| "youtube": "https://www.youtube.com", |
| "whatsapp": "whatsapp://send", |
| "chrome": "googlechrome://", |
| "facebook": "fb://", |
| "instagram": "instagram://", |
| "calculator": "calc://" |
| } |
| |
| speak(f"Searching for {target}...") |
|
|
| if target in fast_list: |
| os.system(f"termux-open-url {fast_list[target]}") |
| return |
|
|
| |
| |
| try: |
| |
| os.system(f"termux-open-url intent:#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;component={target};end") |
| |
| os.system(f"termux-open-url https://www.google.com/search?q={target}+android+app+open") |
| except: |
| speak(f"I couldn't find a path to {target} on this device.") |
|
|
| def listen(): |
| print("\n[Listening...]") |
| try: |
| return subprocess.check_output("termux-speech-to-text", shell=True).decode("utf-8").lower().strip() |
| except: |
| return input("Type command: ").lower().strip() |
|
|
| |
| os.system("clear") |
| speak("Universal app access enabled. Which app should I open, Tamil?") |
|
|
| while True: |
| query = listen() |
| if not query: continue |
| print(f"Tamil: {query}") |
|
|
| if "open" in query: |
| app_to_open = query.replace("open", "").strip() |
| open_app(app_to_open) |
| elif "exit" in query or "stop" in query: |
| speak("Goodbye, Tamil.") |
| break |
| else: |
| try: |
| r = requests.post(COLAB_URL, json={"message": query}, timeout=15) |
| speak(r.json().get("reply", "Brain is thinking...")) |
| except: |
| speak("Brain connection lost.") |
|
|