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.
Project description
PythonAIBrain
Make your first AI Assistant in Python. No complex setup, no advanced coding. Just install, configure, and run!
Installation
Install the PythonAIBrain package:
pip install pythonaibrain==1.1.8
Modules
- Camera
- TTS (Text To Speech)
- PTT (PDF To Text)
- ITT (Image To Text)
- MethAI
- Search
- Memory
- Context
- Brain
- Advance Brain
Camera Module
The pyaitk toolkit supports Camera to click photos and make videos. It can save photos/videos and send them to PyAI for processing.
Example: Start your camera
import pyaitk
from pyaitk import Camera
import tkinter as tk
root = tk.Tk() # Create GUI
Camera(root) # Start camera and pass root as master
root.mainloop() # Run the GUI
Or simply:
from pyaitk.Camera import Start
Start()
Or via Brain module:
from pyaitk import Brain
brain = Brain()
brain.load()
brain.process_messages('Click Photo')
TTS (Text To Speech)
Converts text to speech in male or female voice.
Example
import pyaitk
from pyaitk import TTS
tts = TTS(text='Hello World')
tts.say(voice='david') # Male voice in windows
tts.say(voice='zira') # Female voice in windows
tts.say(voice= 'alex') # Male voice in macos
tts.say(voice= 'samantha') # Female voice in macos
tts.say(voice= 'english') # for linux
By default, tts.say() uses the male voice of windows so agrest with your device type, also see the TTS doc.
PTT (PDF To Text)
Extracts text from a PDF or image.
Example
import pyaitk
from pyaitk import PTT
ptt = PTT(path='example.pdf') # Provide your file path
print(ptt) # Extracted text output
Context Module
Extracts answers from a given text context.
Example
import pyaitk
from pyaitk 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)
print(answer)
Brain Module
A simple AI brain module that classifies input messages and extracts entities like name, location, and age.
Message types classified
- Question
- Answer
- Command
- Shutdown
- Make Directory
- Statement
- Name
- Know
- Start
Notes:
ShutdownandStartcommands require terminal support and do not work on Android or iOS.Make Directorycreates folders on your device.Statementis any plain text that is not a command/question.Namedetects if a message contains a person's name.
How to create intents.json
{
"intents": [
{
"tag": "greeting",
"patterns": ["Hi", "Hello", "Hey", "What's up?", "Howdy"],
"responses": ["Hello! How can I help you today?", "Hey there!", "Hi! What can I do for you?"]
},
{
"tag": "bye",
"patterns": ["Bye", "See you soon", "Take care"],
"responses": ["Bye! Have a great day", "See you"]
}
]
}
Save this as a .json file and provide it to the Brain module.
Usage
from pyaitk import Brain
brain = Brain(intents_path='intents.json') # or Brain() with default
brain.train()
brain.save()
message = input('Message: ')
message_type = brain.predict_message_type(message=message)
if message_type in ['Question', 'Answer']:
print(f'Answer: {brain.process_messages(message=message)}')
Note : train and save the file when use first time or change the default intents.json with your intents.json otherwise use load function by writting,
brain.load() # it returns bool
And also don't forgot to load otherwise it through an error Or,
from pyaitk import Brain
brain = Brain()
brain.load()
message = input('Message: ')
message_type = brain.predict_message_type(message=message)
if message_type in ['Question', 'Answer']:
print(f'Answer: {brain.process_messages(message=message)}')
Advance Brain Module
An advanced version of the Brain module with smarter classification and better entity recognition.
Usage
from pyaitk import AdvanceBrain
advance_brain = AdvanceBrain(intents_path='intents.json') # or AdvanceBrain()
message = input('Message: ')
message_type = advance_brain.predict_message_type(message=message)
if message_type in ['Question', 'Answer']:
print(f'Answer: {advance_brain.process_messages(message=message)}')
Same limitations apply as Brain module for commands.
Python AI Modules Summary
| Module Name | Description |
|---|---|
| Brain | Basic AI brain using .json knowledge base |
| AdvanceBrain | Advanced AI brain with better understanding |
| TTS | Text to speech |
| STT | Speech to text |
| MathAI | Use to solve complex math problems |
| ITT | Image to text extraction |
| Camera | Capture photos and videos |
| Context | Get answers from text contexts |
Built-in AI Assistant - PyBrain
If you prefer not to code your own AI, use the built-in PyBrain GUI or web assistant.
GUI
import PyAgent
PyAgent.App()
Web Server
from PyAgent import PYAS
PYAS.app.run(debug=False)
Or
from PyAgent import Server
server = Server()
server.run()
Visit PyPI for installation and more details.
Start building your AI assistant today with PythonAIBrain! Try to ask your doubt with AI releated to this package!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pythonaibrain-1.1.8.tar.gz.
File metadata
- Download URL: pythonaibrain-1.1.8.tar.gz
- Upload date:
- Size: 7.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8699c232d563bfdec29dd6a1966567b62b02e49c2ce02e4cf2661e88ea2bd86
|
|
| MD5 |
d1db94771b0d98c7d79a25e076796243
|
|
| BLAKE2b-256 |
6fe7dca75461723ab0c985a3b892801b4ec0994b91eec65533272aef821fb877
|
File details
Details for the file pythonaibrain-1.1.8-py3-none-any.whl.
File metadata
- Download URL: pythonaibrain-1.1.8-py3-none-any.whl
- Upload date:
- Size: 7.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5525224fc749c9d350b8c01edfe3af9580df918fddbd7edcfa3dd68207808852
|
|
| MD5 |
01668b7eddf471d44d6c57d8bd7d779e
|
|
| BLAKE2b-256 |
e2e3f0245c51c7d3a6a638493b2a5aa6121ffd41f7f185fc7a1777330f5d89ef
|