Skip to content

Jarvis #28

@pitarkhura79-commits

Description

@pitarkhura79-commits

Install these before running:

pip install speechrecognition pyttsx3 opencv-python

import speech_recognition as sr
import pyttsx3
import cv2

Initialize speech engine

engine = pyttsx3.init()

def speak(text):
engine.say(text)
engine.runAndWait()

Voice Recognition

def listen():
r = sr.Recognizer()
with sr.Microphone() as source:
print("🎤 Jarvis Listening...")
audio = r.listen(source)
try:
text = r.recognize_google(audio)
print("👉 You said:", text)
return text
except:
speak("Sorry, I didn't catch that.")
return ""

Video Assistant Window

def video_window():
cap = cv2.VideoCapture(0)
while True:
ret, frame = cap.read()
cv2.imshow("🖥️ Jarvis Video Assistant", frame)
if cv2.waitKey(1) & 0xFF == ord('q'): # Press Q to exit
break
cap.release()
cv2.destroyAllWindows()

Main Loop

speak("Hello Johan sir, I am Jarvis. Say something!")
command = listen().lower()

if "video" in command:
speak("Opening video window for you.")
video_window()
else:
speak("Okay, I am ready for your next command.")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions