Skip to content

ChatGPT API endpoint powered by the pre-trained GPT-2 language model from the transformers library. By accepting prompts from users, it dynamically generates text with contextual depth. The versatility of GPT-2 facilitates nuanced responses, making it adept at adapting to diverse user inputs and fostering rich, interactive conversations

License

Notifications You must be signed in to change notification settings

mramitdas/chatgpt_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GPT2 Language Model API

Info:See OpenAI site for the latest source.
Documentation:Available at ChatGPT
Author: Amit Das

About

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.

Download Repo

Installation

You can install the dependencies using the following command:

pip install -r requirements.txt

Usage

To start the server, simply run the following command:

python3 app.py

This will start the server on http://localhost:8000.

Endpoint

The API has a single endpoint /generate which accepts a POST request with a JSON payload containing the prompt string to generate text from. The generated text is then returned in the response.

Example Request

POST /generate HTTP/1.1
Host: localhost:8000
Content-Type: application/json

{
    "prompt": "The quick brown fox"
}

Example Response

HTTP/1.1 200 OK
Content-Type: text/plain

jumps over the lazy dog.

References

About

ChatGPT API endpoint powered by the pre-trained GPT-2 language model from the transformers library. By accepting prompts from users, it dynamically generates text with contextual depth. The versatility of GPT-2 facilitates nuanced responses, making it adept at adapting to diverse user inputs and fostering rich, interactive conversations

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages