https://github.com/gagan3012/keytotext
Keywords to Sentences
https://github.com/gagan3012/keytotext
api docker huggingface-transformers keytotext keywords nlp sentences streamlit t5
Last synced: 16 days ago
JSON representation
Keywords to Sentences
- Host: GitHub
- URL: https://github.com/gagan3012/keytotext
- Owner: gagan3012
- License: mit
- Created: 2021-02-20T13:08:44.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-08-15T22:12:17.000Z (almost 2 years ago)
- Last Synced: 2025-04-12T17:46:52.901Z (about 2 months ago)
- Topics: api, docker, huggingface-transformers, keytotext, keywords, nlp, sentences, streamlit, t5
- Language: Jupyter Notebook
- Homepage: https://share.streamlit.io/gagan3012/keytotext/UI/app.py
- Size: 4.04 MB
- Stars: 450
- Watchers: 12
- Forks: 57
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Citation: CITATION.cff
Awesome Lists containing this project
README
keytotext
[](https://pypi.org/project/keytotext/)
[](https://pepy.tech/project/keytotext)
[](https://colab.research.google.com/github/gagan3012/keytotext/blob/master/notebooks/K2T.ipynb)
[](https://share.streamlit.io/gagan3012/keytotext/UI/app.py)
[](https://github.com/gagan3012/keytotext#api)
[](https://hub.docker.com/r/gagan30/keytotext)
[](https://huggingface.co/models?filter=keytotext)
[](https://keytotext.readthedocs.io/en/latest/?badge=latest)
[](https://github.com/psf/black)
[](https://www.codefactor.io/repository/github/gagan3012/keytotext)
Idea is to build a model which will take keywords as inputs and generate sentences as outputs.
Potential use case can include:
- Marketing
- Search Engine Optimization
- Topic generation etc.
- Fine tuning of topic modeling models## Model:
Keytotext is based on the Amazing T5 Model: [](https://huggingface.co/models?filter=keytotext)
- `k2t`: [Model](https://huggingface.co/gagan3012/k2t)
- `k2t-base`: [Model](https://huggingface.co/gagan3012/k2t-base)
- `mrm8488/t5-base-finetuned-common_gen` (by Manuel Romero): [Model](https://huggingface.co/mrm8488/t5-base-finetuned-common_gen)Training Notebooks can be found in the [`Training Notebooks`](https://github.com/gagan3012/keytotext/tree/master/notebooks) Folder
**Note**: To add your own model to keytotext Please read [`Models Documentation`](https://github.com/gagan3012/keytotext/blob/master/docs/MODELS.md)
## Usage:
Example usage: [](https://colab.research.google.com/github/gagan3012/keytotext/blob/master/notebooks/K2T.ipynb)
Example Notebooks can be found in the [`Notebooks`](https://github.com/gagan3012/keytotext/tree/master/examples) Folder
```shell script
pip install keytotext
```
## Trainer:
Keytotext now has a trainer class than be used to train and finetune any T5 based model on new data. Updated Trainer docs here: [`Docs`](https://github.com/gagan3012/keytotext/blob/master/docs/TRAINER.md)
Trainer example here: [](https://colab.research.google.com/github/gagan3012/keytotext/blob/master/notebooks/Trainer.ipynb)
```python
from keytotext import trainer
```
## UI:
UI: [](https://share.streamlit.io/gagan3012/keytotext/UI/app.py)
```shell script
pip install streamlit-tags
```
This uses a custom streamlit component built by me: [GitHub](https://github.com/gagan3012/streamlit-tags)
## API:
API: [](http://localhost:8000/api?data=[%22India%22,%22Capital%22,%22New%20Delhi%22])
[](https://hub.docker.com/r/gagan30/keytotext)The API is hosted in the Docker container and it can be run quickly.
Follow instructions below to get started```shell script
docker pull gagan30/keytotextdocker run -dp 8000:8000 gagan30/keytotext
```This will start the api at port 8000 visit the url below to get the results as below:
```
http://localhost:8000/api?data=["India","Capital","New Delhi"]
```
Note: The Hosted API is only available on demand
## BibTex:To quote keytotext please use this citation
```bibtex
@misc{bhatia,
title={keytotext},
url={https://github.com/gagan3012/keytotext},
journal={GitHub},
author={Bhatia, Gagan}
}
```# References
- https://github.com/Shivanandroy/simpleT5 (Shivanand Roy)
- https://github.com/patil-suraj/question_generation (Suraj Patil)
- https://github.com/MathewAlexander/T5_nlg (Mathew Alexander)## Articles about keytotext:
- https://towardsdatascience.com/data-to-text-generation-with-t5-building-a-simple-yet-advanced-nlg-model-b5cce5a6df45 (Mathew Alexander)
- Amazing Video by [1LittleCoder](https://twitter.com/1littlecoder) here: https://www.youtube.com/watch?v=I0iBzP-SxFY about keytotext
- https://medium.com/mlearning-ai/generating-sentences-from-keywords-using-transformers-in-nlp-e89f4de5cf6b (Prakhar Mishra)