This is a completed JorneAI Chatbot Project that provides travel-related advice through a conversational AI, including intent data, a neural network model, and a Gradio interface. To get started, review all provided resources to understand the project structure, including the intent data and the model. Follow the setup instructions in the README, install necessary dependencies, and train the model with the provided data.
Ensure the chatbot meets basic requirements by verifying it responds correctly to user queries based on recognized intents. Once the core functionality is working, feel free to extend the project by adding new intents, improving performance, or enhancing the Gradio interface for a better user experience.
Review the README and familiarize yourself with the chatbot’s purpose.
Install the required libraries: TensorFlow, Gradio, and NLTK.
Review the provided intent data. Explore creating your own additional intents for extended functionality.
Preprocess the data and train the neural network as described in the script.
Interact with the chatbot using Gradio. Identify any gaps in responses and modify intent data as needed.
Write a report doc on how the project was set up, the challenges faced, and how they were resolved.
JorneAI is a chatbot designed to assist users with travel-related queries and recommendations. It employs natural language processing and a neural network model to understand user inputs and generate appropriate responses.
- Intent recognition for various travel-related queries.
- Dynamic responses based on recognized intents.
- Integration with Gradio for a user-friendly interface.
The primary objective of JorneAI is to provide users with personalized and engaging travel advice, helping them plan their trips effectively.
To install JorneAI and its dependencies, use the following commands:
!pip install gradio
Ensure the following dependencies are installed:
TensorFlow
Gradio
NLTK
Intent data is structured in a JSON format with tags, patterns, and responses. Each intent represents a category of user queries.
{
"intents": [
{
"tag": "greeting",
"patterns": ["hi", "hello", "hey"],
"responses": ["Greetings!", "Hello there!", "Hey!"]
},
...
]
}
The script preprocesses the intent data, tokenizes patterns, and trains the neural network using backpropagation.
JorneAI's model consists of an input layer, hidden layers, and an output layer. It uses the ReLU activation function for hidden layers and softmax for the output layer.
The model is compiled with the Adam optimizer and categorical crossentropy loss function. It is trained for 1000 epochs with a batch size of 8.
Gradio is integrated to provide a simple text-based interface for users to interact with JorneAI.
iface = gr.Interface(fn=chat, inputs="text", outputs="text")
iface.launch()
User input is processed by tokenizing and stemming words using NLTK.
The model predicts the user's intent and generates a response based on the highest confidence.
Intent recognition involves identifying the most probable intent from the model's predictions.
Responses are generated based on the recognized intent, and a random response is selected from the predefined responses.
The model is compiled with the Adam optimizer, categorical crossentropy loss, and accuracy as a metric.
The model is trained on preprocessed data for 1000 epochs with a batch size of 8.
The trained model is saved as jornebot_model.h5, and preprocessing data is saved as preprocess_data.pkl.
The script includes components for intent data, model architecture, training, user input processing, and response generation.
Functions include those for cleaning up sentences, creating bag-of-words representations, and the main chat function.
NLTK is used for tokenizing and stemming words in user input and intent patterns.
Responses are randomly selected from the predefined responses for a more natural conversation flow.
User inputs are processed, and the chat function generates appropriate responses based on recognized intents.