Email writer is a gpt-2 based email generator application. It is a fine-tune version of gpt-2-medium model which is trained on this datasets. Model published in huggingface model hub
request = {
"prompt": str,
"token_count": int,
"temperature": float,
"n_gen": int,
"keywords": list
}
response = {
"status": str,
"ai_results": [
{
"generated_text": str,
"text_length": int
},
]
}
environment setup using environment.yml
file
conda env create -f environment.yml
conda activate email_writer_env
pip install -r requirements.txt
# install pytorch >= 1.11
conda install pytorch cudatoolkit=11.3 -c pytorch
This application is based one Flask framework. Default port for this application is 5000.
python app.py
Change input data
in tests/test_app.py
to test different inputs.
python -m tests.test_app
or
import requests
data = {
"prompt": "love to visit again", # subject of the email
"token_count": 128,
"temperature": 0.6,
"n_gen": 4,
"keywords": ['experience', 'joyfull', 'sea'] # relevant keywords
}
response = requests.post('http://localhost:5000/generate', json=data)
print(response.json())