DEV Community

Cover image for Build Your Own Powerful AI Assistant Offline With Pythonaibrain
Divyanshu Sinha
Divyanshu Sinha

Posted on

Build Your Own Powerful AI Assistant Offline With Pythonaibrain

Ever dreamed of creating your own smart AI assistant that runs completely offline? Meet Pythonaibrain a Python package that makes building advanced AI super easy and powerful.

Step 1: Install Pythonaibrain

Just run:

pip install pythonaibrain==1.1.8

Step 2: Your First AI Brain

from pyaitk import Brain

brain = Brain('intents.json') # give your dataset
brain.train() # train it
brain.save() # save it
# if already trained then simply load your model no need to train and save it again
# brain.load()
response = brain.process(input("Enter your message : "))
print(response)

# If want to add you python function, use function mapping 
# brain = Brain("intents.json", name_of_your_function = <function name>)
# like
# def p():
#     return "Hello"
# brain= Brain("intents.json", hello= p)
Enter fullscreen mode Exit fullscreen mode

This simple code loads the AI brain and gets a response to your input.

Top comments (0)