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

Neuralintents library not working #29

Open
sebasop320 opened this issue Dec 12, 2022 · 1 comment
Open

Neuralintents library not working #29

sebasop320 opened this issue Dec 12, 2022 · 1 comment

Comments

@sebasop320
Copy link

Hello i am having a problem with the lybrary when I execute the code this error 'Exception has occurred: ModuleNotFoundError
No module named 'neuralintents'
File "/Users/sebastianocampopena/Desktop/AI/main.py", line 6, in
from neuralintents import GenericAssistant
ModuleNotFoundError: No module named 'neuralintents''

and this is the code "
import sys
import threading
import tkinter as tk
import speech_recognition
import pyttsx3 as tts
from neuralintents import GenericAssistant

class assistant:
def init(self):
self.recognizer = speech_recognition.Recognizer()
self.speaker = tts.init()
self.speaker.setProperty('rate', 150)

    self.assistant = GenericAssistant("intents.json", intent_methods={"file":self.create_file})
    self.assistant.train_model()
    self.root = tk.Tk()
    self.label = tk.Label(text="🤖", font =("arial", 120, "bold"))
    self.label.pack()

    threading.Thread(target=self.run_assistant).start()

    self.root.mainloop()


def create_file(self):
    with open ("somefile.txt", "w") as f:
        f.write("hello world")

def run_assistant(self):
    while True:
        try:
            with speech_recognition.Microphone() as mic: 
                self.recognizer.adjust_for_ambient_noise(mic, duration=0.2)
                audio = self.recognizer.listen(mic)

                text = self.recognizer.recognize_google(audio)
                text = text.lower()


                if "hey jake" in text:
                    self.label.config(fg="red")
                    audio = self.recognizer.listen(mic)
                    text = self.recognizer.recognize_google(audio)
                    text = text.lower()
                    if text == "stop":
                        self.speaker.say("bye")
                        self.speaker.runAndWait()
                        self.speaker.stop()
                        self.root.destroy()
                        sys.exit()
                    else:
                        if text is not None: 
                            response = self.assistant.request(text)
                            if response is not None:
                                self.speaker.say(response)
                            
        except:
            pass

assistant()
"

PLEASE HELP

Thanks!

@youshitsune
Copy link

Do you get ModuleNotFoundError only for this code?

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

2 participants