Example #1
0

def quit():
    speaker.say('Bye')
    speaker.runAndWait()
    sys.exit(0)


mappings = {
    "greeting": hello,
    "create_note": create_note,
    "add_todo": add_todo,
    "show_todos": show_todo,
    "exit": quit
}
assistant = GenericAssistant('intents.json', intent_methods=mappings)
assistant.train_model()
#assistant.request('How are you')

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

            message = recognizer.recognize_google(audio)
            message = message.lower()

        assistant.request(message)
    except speech_recognition.UnknownValueError:
        recognizer = speech_recognition.Recognizer()
Example #2
0
def todo_remove():
    idx = int(input("Which Todo To remove (number) : ")) - 1

    if idx < len(todos):
        print(f"removig {todos[idx]}")
        todos.remove(idx)
    else:
        print("There Is no todo list")


def bye():
    print("Bye")
    sys.exit()


mapping = {
    'stocks': stock_function,
    'todoshow': todo_show,
    'todoadd': todo_add,
    'todoremove': todo_remove,
    'goodbye': bye,
}
assistent = GenericAssistant("shorts_intens.json", mapping)

# assistent.train_model()
assistent.load_model()
# assistent.save_modelhi()

while True:
    message = input("message :")
    assistent.request(message)
Example #3
0
from neuralintents import GenericAssistant
from fx import mappings
import speech
from tkinter import *
from PIL import ImageTk, Image
import threading, sys

assistant = GenericAssistant('intents.json',
                             model_name="model",
                             intent_methods=mappings)
# assistant.train_model()
# assistant.save_model()
assistant.load_model()


def mainLoop(app):

    while True:

        speech.waitForWakeupCall("kiwi")
        working = True
        counter = 0

        while working:
            counter += 1
            message = speech.takeCommand()

            if counter > 5:
                message = "enough work for today"
                working = assistant.request(message)
                break
Example #4
0
import pandas as pd
import pandas_datareader as web
import mplfinance as mpf

import pickle
import sys
import datetime as dt


def myfunction():
    pass


mappings = {'greetings': myfunction}

assistant = GenericAssistant('intents.json', intent_methods=mappings)

assistant.train_model()

assistant.request("Hello")

portfolio = {'AAPL': 20, 'TSLA': 5, "GS": 10}

with open('portfolio.pkl', 'wb') as f:
    pickle.dumb(portfolio, f)

print(portfolio)


def save_portfolio():
    with open('portfolio.pkl', 'wb') as f: