AIParrot is an intelligent conversational AI that uses sequence models and word embedding to generate responses to a given question.
Open In Colab
This project is built using Python and Tensorflow & Keras.
Sequence-to-sequence(Seq2Seq) models are built for converting sequences from one domain to a meaningful sequence in another domain (e.g. machine translation, chatbot...).
This corpus contains a large metadata-rich collection of fictional conversations extracted from raw movie scripts:
- 220,579 conversational exchanges between 10,292 pairs of movie characters
- involves 9,035 characters from 617 movies
- in total 304,713 utterances
- movie metadata included:
- genres
- release year
- IMDB rating
- number of IMDB votes
- IMDB rating
- character metadata included:
- gender (for 3,774 characters)
- position on movie credits (3,321 characters)
- see README.txt (included) for details
# clone the repo
git clone https://github.com/YigitGunduc/AIParrot.git
# install requirements
pip install -r requirements.txt
# navigate to the AIParrot/neuralnet folder
cd AIParrot/neuralnet
#run train.py
python3 train.py
to tweak model params and values see AIParrot/neuralnet/config.py
python3 chat.py
or
from tokenizers import Tokenizer
from generate import Predict, Seq2SeqModel
tokenizer = Tokenizer()
# loading tokenizer
tokenizer.load_tokenizer('AIParrot/neuralnet/tokenizer-vocab_size-5000.pickle')
# loading pretrained weight
Seq2SeqModel.load_weights('AIParrot/weights/seq2seq-weigths-epochs-1100.h5')
predict = Predict(Seq2SeqModel, tokenizer)
print(predict.create_response('How are you?'))
- Could you please repeat that?
- what is wrong
- Thank you. That helps a lot.
- i love you too
- hey!
- hey
- What do you mean?
- i mean you are a <unk>
- Hi! I’m Alex. And you?
- yes
- Where are you from?
- i am out
- How can I help you?
- i don't know
- I have no idea
- you are not going to hurt me i am not going to hurt you
# navigate to the AIParrot/webapp folder
cd AIParrot/webapp
# run app.py
python3 app.py
# check out http://127.0.0.1:5000/
AIParrots web API can used as shown below
import requests
response = requests.get("/http://127.0.0.1:5000/api/?q=QUERY")
#raw response
print(response.json())
#cleaned up response
print(response.json()["response"])
'''
{
"response": "hey"
}
'''
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.