Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

save_brain() error when saving the brain file on mac #10

Open
Flashxyz opened this issue Nov 17, 2023 · 0 comments
Open

save_brain() error when saving the brain file on mac #10

Flashxyz opened this issue Nov 17, 2023 · 0 comments

Comments

@Flashxyz
Copy link

Flashxyz commented Nov 17, 2023

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant