zaghlol94 / mail-generation-service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mail-generation-service

/generate

Description generate mails samples from AI language model.
Method GET
URL/Data Parameters
prompt str, required the initial text that we want to generate some other words after it.
n_gen int, required Defines how many alternatives will be returned.
temperature float, non-required default: 0.8 The value used to module the next token probabilities.
top_k int, non-required default: 50 the top k most likely next words are selected and
the entire probability mass is shifted to these k
words. So instead of increasing the chances of high
probability words occurring and
decreasing the chances of low probability words,
we just remove low
probability words all together We just need
to set top_k to however many of the top words we want to consider
for our conditional probability distribution.
top_p float, non-required default: 0.8 If set to float < 1, only the most probable tokens with probabilities that add up to top_p or higher are kept for generation.
token_count int, non-required default: 100 maximum number of words that we want to generate per example.
Success Response Code: 200 OK
Type: JSON
Content:
{
   "status": "success",
    "ai_results": [{"generated_text": "generated text","text_length": 753}]
}
             
Error Response Code: 400 Bad Request | 500 Internal Server Error
Type: JSON
Content:
{
    "status": "FAIL",
    "error": "::string"
}
        

run the deployed service in the browser

open your browser chrome or firefox
write in the url bar:
https://mail-generation-fguxvzvh6a-uc.a.run.app/generate?prompt=to&n_gen=3

browser result

run swagger documentation of the deployed service

open your browser chrome or firefox
write in the url bar:
https://mail-generation-fguxvzvh6a-uc.a.run.app/docs

swagger result

run the service locally

run in the terminal
git clone https://github.com/zaghlol94/mail-generation-service.git
cd mail-generation-service
export $PORT=5000
sudo docker build -t email .
sudo docker run -p 5000:5000 email
open browser and write in the url:
http://0.0.0.0:5000/generate?prompt=to&n_gen=3
or
http://0.0.0.0:5000/docs

About

License:MIT License


Languages

Language:Python 86.3%Language:Dockerfile 10.3%Language:Shell 3.4%