Git Product home page Git Product logo

jarvis-ai-assistant's Introduction

JARVIS-AI-ASSISTANT

A true Artificial Intelligent Assistant with ALICE as backend and offline speech recognition with vosk engine and pyttsx3 as text to speech engine

Unlike other assistants, this JARVIS is truly an ai written with ALICE files which uses Lisp as background.

Any issues on downloading and using this assistant, feel free to raise an issue so I can look into the problem code. Please follow the below installation process to get it done nicely for your needs.

About JARVIS

Jarvis is actually an ai which was introduced in the first Iron Man movie. A very spohisticated AI for Tony Stark made programmers think about making their on AI Assistants. This JARVIS also got it's inspiration fro Iron Man movies.

JARVIS - JOEL'S ARTIFICIAL REALISTIC VIRTUAL INTERNET SERVICE"

There had been many different versions of my Jarvis in the past few months. First, it had been a text assistnat, then speech came and this version is my first every fully artificially intelligent jarvis program with AIML. This is completely written in Python and it is compatible with almost all systems (Mac OS, Linux and Windows(Recommended)). Being written in Windows, it is more suitable to be used in Windows. Some minor changes will be needed to run on other os.

See my first JARVIS project (text to speech only) - https://github.com/JoelShine/JARVIS-The-Ultimate-Project

See my second JARVIS initiative (speech recognition) - https://github.com/JoelShine/Jarvis-v2.0

Specialty of JARVIS

  • Fully autonomous with AIML and Lisp as the brain of JARVIS.
  • Support with offline speech recognition with the help of vosk models.
  • Offline Text to Speech service with pyttsx3.
  • More surer program launching mechanism.
  • Very powerful chat mode with ALICE files.

Setup Procedures

For getting JARVIS up and running, the instructions are given below :

Environment setup

Installing the required modules

  • First, navigate to this cloned repository and open cmd and then type :

pip install -r requirements.txt
  • Most of the times, you may run into an error saying 'no module named pyaudio'. If there is any error on installing SpeechRecognition, do check out this website. Please download the ".whl" file of pyaudio of your python version. Link to website - https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio . After downloading that, pip install that .whl file. For Eg:
pip install PyAudio‑0.2.11‑cp38‑cp38‑win_amd64.whl
  • The above wheel is suitable for Python 3.8 version. amd64 means 64 bit and win32 means 32-bit. First pip install the wheel and then again run pip install -r requirements.txt . After all these procedures, we are ready to start testing out JARVIS.

Getting the models for our Speech Engine

  • Now, the next step is to download the models for our vosk speech Engine. Go to this website for downloading the model of your choice - https://alphacephei.com/vosk/models

  • There are models available for several accents of English and I am currently using the Indian Model. If you are in USA, you could download the usa-english model. The model is not uploaded on github as it will take up large space.
  • Once you have downloaded the Vosk speech engine model, then extract all the files inside the downloaded folder and copy the files inside the 'vosk_speech_engine/model' folder. Make sure to place this in the model folder inside vosk_speech_engine.
  • Once you have placed that, we can successfully run our JARVIS program

Running the Python script

Now we can run our python script. Just navigate to the cloned directory and open cmd and then type :

python jarvis.py

This will initialize the python program. If you run into any problems during the installation of any modules, feel free to open an issue. Thanks for supporting this project and happy coding !!

jarvis-ai-assistant's People

Contributors

joelshine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

jarvis-ai-assistant's Issues

Input overflowed

When running python jarvis.py it seems to respond okay for a moment then just continues rambling without further input and then overflows.

Loading from brain file: brain.dump
Loading brain from brain.dump...done (93208 categories in 1.55 seconds)
Listening
time
The time here is Mon Mar 20 17:46:12 2023
it's not
I heard    is.
i heard
That is interesting.
that is
Is that so.
isn't it
I really couldn't say for sure.
Traceback (most recent call last):
  File "C:\Users\Bannd\Downloads\TEMP\JARVIS-AI-ASSISTANT\jarvis.py", line 54, in <module>
    data = stream.read(4000)
           ^^^^^^^^^^^^^^^^^
  File "C:\Python311\Lib\site-packages\pyaudio\__init__.py", line 570, in read
    return pa.read_stream(self._stream, num_frames,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno -9981] Input overflowed

EXTRA INFO: To get the assistant running I had to edit the file C:\Python311\Lib\site-packages\aiml\Kernel.py and replace all instances of time.clock() with time.time().

save_brain() error when saving the brain file on mac

I downloaded the code from the official git repo:

https://github.com/JoelShine/JARVIS-AI-ASSISTANT

Here is the error in more detail:

`/Volumes/DataDrive/JARVIS-AI-ASSISTANT/jarvis.py
2023-11-17 19:53:16.025 Python[3036:84370] *** Assertion failure in +[UINSServiceViewController initialize], /AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/ViewBridge/ViewBridge-468/UINSServiceViewController.m:203
Parsing aiml files
Saving brain file: brain.dump
Saving brain to brain.dump...Traceback (most recent call last):
File "/Volumes/DataDrive/jarvis_reborn/JARVIS-AI-ASSISTANT/jarvis.py", line 39, in
k.saveBrain(BRAIN_FILE)
File "/Volumes/DataDrive/jarvis_reborn/venv/lib/python3.8/site-packages/aiml/Kernel.py", line 201, in saveBrain
start = time.clock()
AttributeError: module 'time' has no attribute 'clock'

Process finished with exit code:`

Here Was The code i ran

`from vosk import Model, KaldiRecognizer
from playsound import playsound
from vosk import SetLogLevel
import os
import pyaudio
import json
import os
import aiml
import pyttsx4
import sys

SetLogLevel(-1)

engine = pyttsx4.init()
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id)

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

BRAIN_FILE = "brain.dump"

k = aiml.Kernel()

if os.path.exists(BRAIN_FILE):
print("Loading from brain file: " + BRAIN_FILE)
k.loadBrain(BRAIN_FILE)
else:
print("Parsing aiml files")
k.bootstrap(learnFiles="std-startup.aiml", commands="load aiml b")
print("Saving brain file: " + BRAIN_FILE)
k.saveBrain(BRAIN_FILE)

model = Model("vosk_speech_engine/model") #loading model
rec = KaldiRecognizer(model, 16000)

p = pyaudio.PyAudio()
stream = p.open(format=pyaudio.paInt16, channels=1, rate=16000, input=True, frames_per_buffer=8000)
stream.start_stream()

print("Listening")

WAKE = "jarvis"

while True:
data = stream.read(4000)
if len(data) == 0:
break
if rec.AcceptWaveform(data):
result = json.loads(rec.Result())

    query = result['text']
    a = query.lower()

    print(a)

    if a == "quit" or a == "exit" or a == "close" or a == "goodbye":
        speak("THnak You Sir. Have a nice day !")
        print("Bye Sir. Have a nice day !")
        sys.exit()

    else:
        response = k.respond(a)
        speak(response)
        print(response)`

Im running Macos Catalina 10.15.7 and Python version 3.8.0. Do you have any ideas on how I could fix this if you need more info DM me on my Linkedin:

https://www.linkedin.com/in/omar-f-ahmad/

Error while starting

After i run jarvis.py i get this

Parsing aiml files
Traceback (most recent call last):
File "C:\Users%user%\Downloads\AI\jarvis.py", line 37, in
k.bootstrap(learnFiles="std-startup.aiml", commands="load aiml b")
File "C:\Users%user%\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\aiml\Kernel.py", line 131, in bootstrap
start = time.clock()
AttributeError: module 'time' has no attribute 'clock'

Error in _ctypes

After i install requirements and try to run the file i get the following error

python jarvis.py
Traceback (most recent call last):
  File "/opt/anaconda3/lib/python3.9/site-packages/pyttsx3/__init__.py", line 20, in init
    eng = _activeEngines[driverName]
  File "/opt/anaconda3/lib/python3.9/weakref.py", line 137, in __getitem__
    o = self.data[key]()
KeyError: 'sapi5'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/fuad/Desktop/Python workspace/JARVIS-AI-ASSISTANT/jarvis.py", line 14, in <module>
    engine = pyttsx3.init('sapi5')
  File "/opt/anaconda3/lib/python3.9/site-packages/pyttsx3/__init__.py", line 22, in init
    eng = Engine(driverName, debug)
  File "/opt/anaconda3/lib/python3.9/site-packages/pyttsx3/engine.py", line 30, in __init__
    self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
  File "/opt/anaconda3/lib/python3.9/site-packages/pyttsx3/driver.py", line 50, in __init__
    self._module = importlib.import_module(name)
  File "/opt/anaconda3/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/opt/anaconda3/lib/python3.9/site-packages/pyttsx3/drivers/sapi5.py", line 1, in <module>
    import comtypes.client  # Importing comtypes.client will make the gen subpackage
  File "/opt/anaconda3/lib/python3.9/site-packages/comtypes/__init__.py", line 28, in <module>
    from _ctypes import COMError
ImportError: cannot import name 'COMError' from '_ctypes' (/opt/anaconda3/lib/python3.9/lib-dynload/_ctypes.cpython-39-darwin.so)

Do you know how can i fix that. But the way I am using macos.

error

hi @JoelShine im getting this error many thanks

Requirement already satisfied: vosk in c:\users----\appdata\local\programs\python\python312\lib\site-packages (from -r requirements.txt (line 1)) (0.3.45)
Collecting aiml (from -r requirements.txt (line 2))
Using cached aiml-0.9.2-py2.py3-none-any.whl (2.1 MB)
Collecting playsound (from -r requirements.txt (line 3))
Using cached playsound-1.3.0.tar.gz (7.7 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [28 lines of output]
Traceback (most recent call last):
File "C:\Users\Mark\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in
main()

Programs Folder

How does one get to use the sub folder programs in the Standard folder.
Can't open any thru jarvis.py

Error en Paquete

Traceback (most recent call last):
File "/opt/homebrew/lib/python3.10/site-packages/pyttsx3/init.py", line 20, in init
eng = _activeEngines[driverName]
File "/opt/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/weakref.py", line 137, in getitem
o = self.datakey
KeyError: 'sapi5'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/maicolffsa/Downloads/JARVIS-AI-ASSISTANT-main/jarvis.py", line 14, in
engine = pyttsx3.init('sapi5')
File "/opt/homebrew/lib/python3.10/site-packages/pyttsx3/init.py", line 22, in init
eng = Engine(driverName, debug)
File "/opt/homebrew/lib/python3.10/site-packages/pyttsx3/engine.py", line 30, in init
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "/opt/homebrew/lib/python3.10/site-packages/pyttsx3/driver.py", line 50, in init
self._module = importlib.import_module(name)
File "/opt/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/opt/homebrew/lib/python3.10/site-packages/pyttsx3/drivers/sapi5.py", line 1, in
import comtypes.client # Importing comtypes.client will make the gen subpackage
File "/opt/homebrew/lib/python3.10/site-packages/comtypes/init.py", line 28, in
from _ctypes import COMError
ImportError: cannot import name 'COMError' from '_ctypes' (/opt/homebrew/Cellar/[email protected]/3.10.9/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload/_ctypes.cpython-310-darwin.so)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.