
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
PythonAIBrain is a versatile, plug-and-play Python package designed to help you build offline intelligent AI assistants and applications effortlessly. With modules covering speech recognition, text-to-speech, image generation, natural language understanding, and more, PythonAIBrain lets you create powerful AI solutions without deep expertise or complex setup. Whether you’re a beginner or an experienced developer, get ready to bring your AI ideas to life quickly and efficiently.
Make your first offline AI Assistant in python. No complex setup, No advance coding. No API key required. Just install configure and run!
Install pythonaibrain package.
pip install pythonaibrain==1.0.8
PyAI supports Camera to click photos, make videos and scane QR and Bar Code, it can save photos or videos and also send Images and Videos to PyAI to take answer
For start your camera
# Import modules
import pyai
from pyai import Camera
import tkinter as tk
from tkinter import *
root = tk.Tk() # Create the GUI
Camera(root) # Call the Function and pass the master as root
root.mainloop() # Start GUI app
Or,
from pyai.Camera import Start
Start()
Or,
from pyai import Brain
brain = Brain ()
brain.process_messages('Click Photo')
From this you can easly use camera in your program.
TTS stands for Text To Speech, it convert text into both Male voice and Female voice.
# Import modules
import pyai
from pyai import TTS
tts = TTS(text = 'Hello World')
tts.say(voice= 'Male') # for male voice
tts.say(voice= 'Female') #for female voice
tts.say() -> By default it takes Male voice tts.say(voice= 'Male') -> Pass the voice as Male tts.say(voice= 'Female') -> Pass the voice as Female
PTT stands for PDF To Text, it can extract text from a given image
# Import modules
import pyai
from pyai import PTT
ptt = PTT(path = 'example.jpeg') # You can change example.jpeg from your file name
print(ppt) # PTT returns the text extract from the given pdf
ITT(path: str = None)
Give your own file path.
It is a module in pyai which can able to extract answers from the give context
# Import modules
import pyai
from pyai import Contexts
context = '''
Patanjali Ayurved is an Indian company. It was founded by Baba Ramdev and Acharya Balkrishna in 2006.
'''
question = 'Who founded Patanjali Ayurved?'
contexts = Contexts()
answer = contexts.ask(context= context, question= question)
Or, Also
# Import modules
import pyai
from pyai import Contexts as contexts
context = '''
Patanjali Ayurved is an Indian company. It was founded by Baba Ramdev and Acharya Balkrishna in 2006.
'''
question = 'Who founded Patanjali Ayurved?'
answer = contexts.ask(context= context, question= question)
It's a simple brain module which configure the input message.
It classify the input message and find the type of message, like
It also extract the name, location, and age from the given message, by using NER.
The Brain Module classify the given message weather it is a question or something else if answer then returns Question.
The Brain Module classify the given message weather it is a answer or something else if answer then returns Answer.
The Brain Module classify the given message weather it is a command or something else if command then returns Command
The Brain Module also classify the given message weather the given command shutdown or not if it is then it shutdown your device and it returns Shutdown
But there are few issue releated to it :
The Brain Module also classify the given message weather the given command Make Directory or not if it is then it create a Directory on your device and returns Make Dir.
It generally comes under File handling of the PyAI Module which is also known as fh.
The Brain Module also classify the given message weather the given command statement or not, if it is then it statement then it returns Statement.
Statement -> It means a simple text which is not a question, answer, command, etc... It a simple text. Like for example:
The sun rises in the east.
The Brain Module also classify the given message weather the given command name or not, if it is then it name then it returns Name.
Name -> It means the input message is caring name or specify the name like
I'm Divyanshu.
Myself Divyanshu.
Divyanshu Sinha
Know is similar to Statement.
Do you know ___ ?
Like that.
The Brain Module also classify the given message weather the given command start or not, if it is then it start any thing on your device and it returns Start.
Like:
Start www.youtube.com
Or,
Start Notepad
But it have issue:
You should know how to create a intents.json for run this Brain Module.
{
"intents":[{
"tag": "greeting",
"patterns": ["Hi", "Hello", "Hey", "What's up?", "Howdy", "Greetings", "Hi there", "Is anyone there?", "Yo!"],
"responses": ["Hello! How can I help you today?", "Hey there!", "Hi! What can I do for you?"]
},
{
"tag": "bye",
"pattern": ["By", "See you soon", "See u soon", "Take care"],
"responce":["Bye! have a greate day", "See you"]
},
]
}
From this way you can create your own database.
Remember this Database file in .json
To use Brain Module we should import Brain from PyAI
from pyai import Brain
After importing the Module we use it in our main program as,
brain = Brain(intents_path= 'intents.json') # Use can replace intents.json with you database file name but extention should be same (.json)
# Also Use
brain = Brain() # This will also work
After this, we predict the message type of we can say classify the message
message = input('Message : ')
message_type = brain.predict_message_type(message= message) # On using predict_message_type() function we get the type of message is (question, answer, statement, command, shutdown, make directory, name, know, etc...)
By gating the message type, we find the perfect answer for the message
if message_type in ['Question', 'Answer']:
print(f'Answer : {brain.process_messages(message = message)}')
From these things you can create your own AI Assistant. But this is basic.
For Advance we can use Advance Brain Module.
This is advance version of Brain Module It work like Brain but smartly.
It classify the input message and find the type of message, like
It also extract the name, location, and age from the given message, by using NER.
The Brain Module classify the given message weather it is a question or something else if answer then returns Question.
The Brain Module classify the given message weather it is a answer or something else if answer then returns Answer.
The Brain Module classify the given message weather it is a command or something else if command then returns Command
The Brain Module also classify the given message weather the given command shutdown or not if it is then it shutdown your device and it returns Shutdown
But there are few issue releated to it :
The Brain Module also classify the given message weather the given command Make Directory or not if it is then it create a Directory on your device and returns Make Dir.
It generally comes under File handling of the PyAI Module which is also known as fh.
The Brain Module also classify the given message weather the given command statement or not, if it is then it statement then it returns Statement.
Statement -> It means a simple text which is not a question, answer, command, etc... It a simple text. Like for example:
The sun rises in the east.
The Brain Module also classify the given message weather the given command name or not, if it is then it name then it returns Name.
Name -> It means the input message is caring name or specify the name like
I'm Divyanshu.
Myself Divyanshu.
Divyanshu Sinha
Know is similar to Statement.
Do you know ___ ?
Like that.
The Brain Module also classify the given message weather the given command start or not, if it is then it start any thing on your device and it returns Start.
Like:
Start www.youtube.com
Or,
Start Notepad
But it have issue:
You should know how to create a intents.json for run this Advance Brain Module.
{
"intents":[{
"tag": "greeting",
"patterns": ["Hi", "Hello", "Hey", "What's up?", "Howdy", "Greetings", "Hi there", "Is anyone there?", "Yo!"],
"responses": ["Hello! How can I help you today?", "Hey there!", "Hi! What can I do for you?"]
},
{
"tag": "bye",
"pattern": ["By", "See you soon", "See u soon", "Take care"],
"responce":["Bye! have a greate day", "See you"]
},
]
}
From this way you can create your own database.
Remember this Database file in .json
To use Advance Brain Module we should import Brain from PyAI
from pyai import AdvanceBrain
After importing the Module we use it in our main program as,
advance_brain = AdvanceBrain(intents_path= 'intents.json') # Use can replace intents.json with you database file name but extention should be same (.json)
# Also
advance_brain = AdvanceBrain() # This also work
After this, we predict the message type of we can say classify the message
message = input('Message : ')
message_type = advance_brain.predict_message_type(message= message) # On using predict_message_type() function we get the type of message is (question, answer, statement, command, shutdown, make directory, name, know, etc...)
By gating the message type, we find the perfect answer for the message
if message_type in ['Question', 'Answer']:
print(f'Answer : {advance_brain.process_messages(message = message)}')
Module Name | Description |
---|---|
Brain | It is use to create Brain for AI by passing .json file (or, Knowledge for Brain) |
AdvanceBrain | It is use to create Advance Brain for AI by passing .json file (or, Knowledge for Brain). It can understand better than Brain |
TTS | Convert text into Voice |
STT | Convert Voice into Text |
TTI | Convert Text into Image |
ITT | Convert Or, extract Image into Text |
Camera | Use camera to click photos and make videos |
Context | Get Answer from the context for the respective question |
If you don't want to create your own AI assistant by coding or you want to see how this modules work you can also use PyBrain which is a built-in python AI assistance, provided by pythonaibrain == 1.0.2
import PyBrain
PyBrain.App('-g')
By using this you can use PyBrain in GUI.
Or,
import PyBrain
PyBrain.app.run(debug= False)
Or,
from PyBrain import Server
server = Server()
server.run()
By using this you can use PyBrain in Web.
FAQs
PythonAIBrain is a versatile, plug-and-play Python package designed to help you build offline intelligent AI assistants and applications effortlessly. With modules covering speech recognition, text-to-speech, image generation, natural language understanding, and more, PythonAIBrain lets you create powerful AI solutions without deep expertise or complex setup. Whether you’re a beginner or an experienced developer, get ready to bring your AI ideas to life quickly and efficiently.
We found that pythonaibrain demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.