NeuralNine / neuralintents

A simple interface for working with intents and chatbots.
MIT License
241 stars 135 forks source link

Neuralintents library not working #29

Open sebasop320 opened 1 year ago

sebasop320 commented 1 year ago

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 commented 1 year ago

Do you get ModuleNotFoundError only for this code?