:Info: See Core Craft site <https://github.com/Core-Craft/backend/>
_ for the latest source.
:Documentation: Available at ChatGPT <https://github.com/Core-Craft/backend/README.md>
_
:Author: Amit Das
This code provides an API endpoint that generates text based on prompts given by users, using the pre-trained GPT2 language model from the transformers library.
- Fork this repository (Click the Fork button in the top right of this page, click your Profile Image)
- Clone your fork down to your local machine
git clone https://github.com/Core-Craft/backend.git
- Create a branch
git checkout -b branch-name
- Make your changes (choose from any task below)
- Commit and push
git add .
git commit -m 'Commit message'
git push origin branch-name
- Create a new pull request from your forked repository (Click the
New Pull Request
button located at the top of your repo) - Wait for your PR review and merge approval!
- Star this repository if you had fun!
You can install the dependencies using the following command:
.. code-block:: bash
pip install -r requirements/dev.txt
.. end-code-block
To start the server, simply run the following command:
.. code-block:: bash
uvicorn app.main:app --reload
.. end-code-block
This will start the server on http://localhost:8000.
.. code-block:: http
POST /generate HTTP/1.1
Host: localhost:8000
Content-Type: application/json
{
"prompt": "The quick brown fox"
}
.. code-block:: http
HTTP/1.1 200 OK
Content-Type: text/plain
jumps over the lazy dog.
FastAPI <https://fastapi.tiangolo.com/>
_Uvicorn <https://www.uvicorn.org/>
_Pydantic <https://pydantic-docs.helpmanual.io/>
_Transformers <https://huggingface.co/transformers/>
_