Jul 16, 2024
venv
pip install speechrecognition pyaudio ttsx3 webbrowser setuptools
speech_recognition
, pyttsx3
, webbrowser
recognizer = sr.Recognizer()
engine = pyttsx3.init()
speak
function
def speak(text):
engine.say(text)
engine.runAndWait()
while True:
# Listen for 'Jarvis'
with sr.Microphone() as source:
# Your code to capture audio and process further
# Listen for command and process
if command.lower() == 'jarvis':
listen for specific commands
process commands
webbrowser.open
music_library
dictionary
music_library['song name'] = 'url'
OpenAI
for custom responses
pyautogui
, piperclip
, and OpenAI API
pip install pyautogui piperclip openai
pyautogui
content = pyautogui.locateOnScreen('screen.png')
client = openai.ApiClient(api_key='YOUR_API_KEY')
response = client.completion.create(
prompt='Your conversation content',
max_tokens=100
)
response_text = response.choices[0].text.strip()
pyautogui
to copy response to clipboard and send in WhatsApp
pyautogui.write(response_text)
pyautogui.press('enter')
while True:
# Check for new messages and respond