Vab AI is your all-in-one AI toolkit, bringing you cutting-edge AI tools at your fingertips. Picture a world where you can analyze text, get instant answers, and even generate stunning images with the power of AI. It's like having a digital oracle, a text wizard, and an image magician in one place! ππ€π·
- π Table of Contents
- π Overview
- π¦ Features
- π Repository Structure
- βοΈ Modules
- π Object-Oriented Programming Concepts
- How Does π» app.py Work?
- π Getting Started
- π€ Contributing
- π License
- π Acknowledgments
VabAI is an all-in-one AI-powered web application built with a range of cutting-edge technologies and services. It offers an array of features designed to empower users with the latest AI capabilities:
-
GPT-3 Text Analyzer π: Unleash the power of GPT-3 for supercharged text analysis. Extract key insights, discover the most positive words, and visualize named entity recognition for your text.
-
AMA AI (Ask Me Anything) π€: Meet your virtual buddy, AMA AI. Ask questions and receive smart responses in the blink of an eye.
-
Image Generation πΌοΈ: Watch the magic happen with Huggingface Diffusers, conjuring AI-powered images based on your text prompts.
VabAI is powered by OpenAI, Spacy, Bard, and Torch, and is designed for a seamless user experience. Navigate through the features via the sidebar and explore the limitless possibilities of AI.
The project is designed with a clear adherence to object-oriented principles, ensuring modularity and maintainability. It utilizes classes and methods to encapsulate functionality, promoting code organization and reusability.
The project embraces a modular and extensible architecture, allowing for easy integration of new features and components. The use of classes and well-defined interfaces facilitates the addition of functionality without disrupting the existing codebase.
The project includes robust error handling mechanisms to gracefully manage unexpected issues. It leverages Streamlit for error reporting and provides users with informative feedback in case of errors, ensuring a smooth and user-friendly experience.
Configuration and settings management are central to this project. It follows best practices by using environment variables and a '.env' file for storing sensitive API keys and other configuration options. This approach ensures security and easy configuration changes.
Customization is at the heart of the project, allowing users to tailor their interactions. It leverages the power of Streamlit, offering users the ability to personalize their inputs, prompts, and settings to meet their specific needs and preferences.
Streamlit is seamlessly integrated into the project, enhancing its capabilities in error handling and customization. Streamlit is utilized to provide a user-friendly interface for input and output, making it easy for users to interact with the project.
βββ Vab-AI/
βββ .gitattributes
βββ HomePage.png
βββ LICENSE
βββ README.md
βββ app.py
βββ requirements.txt
βββ wordcloud.png
Root
File | Summary |
---|---|
app.py | Source Code File |
The code defines multiple classes, each representing a distinct aspect of the program, including 'HomePage
', 'TextAnalyzer
', 'GPT3Analyzer
', 'AMA_AI
', and 'ImageGenerator
'. Objects of these classes are created and used within the Streamlit application.
Each class encapsulates its data and methods. For example, the 'TextAnalyzer
' class encapsulates the text data to be analyzed and provides methods like 'generate_wordcloud
', 'ner
', and others to manipulate and analyze the text. Encapsulation helps maintain data integrity and prevents unintended modifications from outside the class.
Each class has an __init__
method, which serves as a constructor. It initializes the object's attributes. For instance, the 'TextAnalyzer
' class initializes the text attribute with the provided 'text
' for analysis.
Each class has methods that encapsulate specific functionality. For example, the generate_wordcloud
method in the 'TextAnalyzer
' class generates a word cloud based on the input text, and the generate_image
method in the 'ImageGenerator
' class generates an image based on a text prompt.
The classes define attributes that store data specific to their roles. For example, the text
attribute in the 'TextAnalyzer
' class stores the input text for analysis, and the pipe attribute in the 'ImageGenerator
' class stores the Diffusion Pipeline for image generation.
The use of classes and methods enhances modularity and code reusability. Each class encapsulates a specific set of functionalities, making it easy to reuse and maintain code.
The code separates different functionalities into distinct classes, following the Single Responsibility Principle (SRP) of OOP. For example, the 'TextAnalyzer
' class is responsible for text analysis, while the 'ImageGenerator
' class is responsible for image generation.
Let's break down the code and explain how each part of the application works:
The code starts with several import statements to bring in the necessary libraries and modules, including 'Streamlit
', 'OpenAI
', 'WordCloud
', 'dotenv
', and others. It also sets up OpenAI API credentials using the openai.api_key variable and defines an HTML wrapper for rendering HTML content in Streamlit.
The HomePage class represents the home page of the application. It provides a multi-tab interface with three tabs: "Home
," "Terms
," and "Privacy Policy.
" Each tab displays content related to the application, such as an introduction to 'Vab AI
', 'terms of use
', and a 'privacy policy
'.
The TextAnalyzer class is used to perform text analysis tasks on user-provided text. It includes methods for generating word clouds and performing Named Entity Recognition (NER) using spaCy. These methods utilize the WordCloud and spaCy libraries to process and visualize text data.
The GPT3Analyzer class extends the TextAnalyzer class and specializes in using the GPT-3 model for more advanced text analysis. It has methods for extracting key insights and finding the most positive keywords from a given text using the GPT-3 model.
The AMA_AI
class represents the "Ask Me Anything
" AI feature. It uses the "Bard
" API to provide responses to user queries. Users can input their questions, and the class fetches responses from the Bard API and displays them in a chat-like interface.
The ImageGenerator
class is responsible for generating images based on user-provided text prompts. It uses the 'Huggingface Diffusion model
' to create images from textual descriptions.
The Streamlit code handles the user interface and application flow. It configures the Streamlit page layout, defines the sidebar with navigation options, and selects the appropriate page based on user selection. The selected page is an instance of one of the classes mentioned above (e.g., 'HomePage
', 'GPT3Analyzer
', 'AMA_AI
', or 'ImageGenerator
'), and it is displayed in the main content area.
For the "GPT3 Text Analyzer
" section, users can input text, analyze it, and view the results, including key findings
, word clouds
, and NER visualizations
.
The "AMA AI
" section allows users to ask questions, and the AI responds with answers fetched from the Bard API
.
The "Image Generation
" section lets users input text prompts to generate images using the Huggingface Diffusion model
.
The application is designed to be an all-in-one AI tool that integrates various AI capabilities and presents them through a user-friendly interface. Users can interact with the application to perform text analysis, get answers to questions, and generate images from text prompts. π±π€―
This guide will walk you through the steps to set up the Vab AI project on your local machine.
Before you begin, ensure you have the following:
- Python 3.11.6 installed on your machine.
- An OpenAI API key π.
- A Bard API key π.
- Git installed on your machine π.
-
Open your terminal or command prompt.
-
Navigate to the directory where you want to store the Vab AI project:
cd /path/to/your/directory
-
Clone the Vab AI repository from GitHub:
git clone https://github.com/vaibhavkumawat-17/Vab-AI.git
-
Navigate to the project directory:
cd Vab-AI
-
Create a virtual environment. You can use
venv
orvirtualenv
. Here's an example usingvenv
:python -m venv venv
-
Activate the virtual environment:
-
On Windows:
venv\Scripts\activate
-
On macOS and Linux:
source venv/bin/activate
-
-
While in the virtual environment, install the required dependencies using
pip
:pip install -r requirements.txt
-
Visit the OpenAI website to obtain an API key if you don't have one.
-
Open the
app.py
file in your project directory. -
Locate the following line in
app.py
:openai.api_key = "Your-OpenAI-API-key"
-
Replace
"Your-OpenAI-API-key"
with your actual OpenAI API key.
-
Open the
app.py
file in your project directory. -
Locate the following lines in
app.py
:os.environ["_BARD_API_KEY"] = "Your-Bard-API-key" bard = Bard()
-
Replace
"Your-Bard-API-key"
with your actual Bard API key. -
view this Tutorial if you are facing problems while getting the
Bard api key
-
In the terminal, while your virtual environment is active, run the Streamlit application:
streamlit run app.py
-
The application should open in your default web browser.
You're all set! You can now explore the Vab AI web application and its various features, including text analysis, "Ask Me Anything" AI, and image generation.
Enjoy using Vab AI! If you encounter any issues or have questions, refer to the project's GitHub repository or reach out to me the for support.
That's it! You've successfully set up and configured the Vab AI project on your local machine. Happy exploring! π
Contributions are always welcome! Please follow these steps:
- Fork the project repository. This creates a copy of the project on your account that you can modify without affecting the original project.
- Clone the forked repository to your local machine using a Git client like Git or GitHub Desktop.
- Create a new branch with a descriptive name (e.g.,
new-feature-branch
orbugfix-issue-123
).
git checkout -b new-feature-branch
- Make changes to the project's codebase.
- Commit your changes to your local branch with a clear commit message that explains the changes you've made.
git commit -m 'Implemented new feature.'
- Push your changes to your forked repository on GitHub using the following command
git push origin new-feature-branch
- Create a new pull request to the original project repository. In the pull request, describe the changes you've made and why they're necessary. The project maintainers will review your changes and provide feedback or merge them into the main branch.
This project is licensed under the MIT License. See the MIT License file for additional information.
- βΉοΈ https://www.youtube.com/watch?v=kT8Q7aIlgy0&list=PL1L4LZThqJ_ysjdi_xGdu5oChyqypVTtA&index=3
- βΉοΈ https://www.youtube.com/watch?v=e63kZ-4rGIg&list=PL1L4LZThqJ_ysjdi_xGdu5oChyqypVTtA&index=8&t=210s
- βΉοΈ https://www.youtube.com/watch?v=17oHPkhgCuk&list=PLrLEqwuz-mRJCRfUXQLCB8IFvHPlh7IjF&index=11