Skip to content

Latest commit

 

History

History
199 lines (143 loc) · 5.13 KB

README.md

File metadata and controls

199 lines (143 loc) · 5.13 KB

Contributors Forks Stargazers Issues MIT License Open In Colab


AIParrot

AIParrot is an intelligent conversational AI that uses sequence models and word embedding to generate responses to a given question.

Open In Colab

Built With

This project is built using Python and Tensorflow & Keras.

Model

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...).

seq2seq model

Data

Cornell Movie--Dialogs Corpus

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

Getting Started

Installation

# clone the repo
git clone https://github.com/YigitGunduc/AIParrot.git

# install requirements
pip install -r requirements.txt

Training

# 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

Generating Text from Trained Model

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?'))

Chat responses

- 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

Running the Web-App Locally

Alt text

# navigate to the AIParrot/webapp folder 
cd AIParrot/webapp

# run app.py
python3 app.py

# check out http://127.0.0.1:5000/

API

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"
}
'''

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

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.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.