Code Monkey home page Code Monkey logo

backendcc's Introduction

======================= Core Craft REST API

: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

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.

Getting started

  • 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!

Installation

You can install the dependencies using the following command:

.. code-block:: bash

pip install -r requirements/dev.txt

.. end-code-block

Usage

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.

Endpoint

http://localhost:8000/docs

Example Request

.. code-block:: http

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

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

Example Response

.. code-block:: http

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

jumps over the lazy dog.

References

  • FastAPI <https://fastapi.tiangolo.com/>_
  • Uvicorn <https://www.uvicorn.org/>_
  • Pydantic <https://pydantic-docs.helpmanual.io/>_
  • Transformers <https://huggingface.co/transformers/>_

backendcc's People

Contributors

mramitdas avatar shagunpatial avatar techonerd avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.