Code Monkey home page Code Monkey logo

hfendpoint's Introduction

HFEndpoint - Set up local API Endpoint for any HuggingFace model

This package provides the user with one method that opens a local API endpoint for any from HuggingFace Model Hub.

This package utilizes the FastAPI library to set up an API Endpoint under 127.0.0.1:8000/docs. It also makes use of HuggingFace's transformers package, pydantic, and a package I created hfloader. Which can be found here.

Installation

The package can be installed with the following command:

pip install hfendpoint

How to Use

To use this package, all you need to do is import the package via this command.

from hfendpoint import LoadApiEndpoint

The function LoadApiEndpoint expects one variable of type str. This can be a local path to a model, or any package on the HuggingFace Model Hub.

Usage may look something along the lines of:

from hfendpoint import LoadApiEndpoint

app = LoadApiEndpoint("cardiffnlp/twitter-roberta-base-sentiment")

Important:

After running the script and loading the api endpoint, you have to call this command in cmd:

uvicorn script:app --reload

So, if the script that was written was called script.py, you need to exclude the .py in the command call.

Requirements

pip install transformers pip install fastapi pip install uvicorn pip install pydantic

Notes

I don't have plans to upkeep this project unless it necessitates it. I was able to achieve the goal I had set out when developing the package.

hfendpoint's People

Contributors

solonce avatar

Watchers

 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.