Coder Social home page Coder Social logo

rageagainstthepixel / com.rest.huggingface Goto Github PK

View Code? Open in Web Editor NEW
15.0 2.0 1.0 2.33 MB

A Non-Official HuggingFace Rest Client for Unity (UPM)

Home Page: https://huggingface.co/

License: MIT License

C# 100.00%
ai generative-ai generative-art generative-design huggingface inference-api unity upm upm-package unity3d

com.rest.huggingface's Introduction

com.rest.huggingface

Discord openupm openupm

A non-official HuggingFace RESTful client for the Unity Game Engine.

I am not affiliated with HuggingFace and an account with api access is required.

All copyrights, trademarks, logos, and assets are the property of their respective owners.

Installing

Requires Unity 2021.3 LTS or higher.

The recommended installation method is though the unity package manager and OpenUPM.

Via Unity Package Manager and OpenUPM

  • Open your Unity project settings
  • Select the Package Manager scoped-registries
  • Add the OpenUPM package registry:
    • Name: OpenUPM
    • URL: https://package.openupm.com
    • Scope(s):
      • com.rest.huggingface
      • com.utilities
  • Open the Unity Package Manager window
  • Change the Registry from Unity to My Registries
  • Add the HuggingFace package

Via Unity Package Manager and Git url

Documentation

Table of Contents

Authentication

There are 4 ways to provide your API keys, in order of precedence:

⚠️ We recommended using the environment variables to load the API key instead of having it hard coded in your source. It is not recommended use this method in production, but only for accepting user credentials, local testing and quick start scenarios.

  1. Pass keys directly with constructor ⚠️
  2. Unity Scriptable Object ⚠️
  3. Load key from configuration file
  4. Use System Environment Variables

Pass keys directly with constructor

var api = new HuggingFaceClient("yourApiKey");

Or create a HuggingFaceAuthentication object manually

var api = new HuggingFaceClient(new HuggingFaceAuthentication("yourApiKey"));

Unity Scriptable Object

You can save the key directly into a scriptable object that is located in the Assets/Resources folder.

You can create a new one by using the context menu of the project pane and creating a new HuggingFaceConfiguration scriptable object.

Create new HuggingFaceConfiguration

Load key from configuration file

Attempts to load api keys from a configuration file, by default .huggingface in the current directory, optionally traversing up the directory tree or in the user's home directory.

To create a configuration file, create a new text file named .huggingface and containing the line:

Json format
{
  "apiKey": "yourApiKey",
}

You can also load the file directly with known path by calling a static method in Authentication:

var api = new HuggingFaceClient(new HuggingFaceAuthentication().LoadFromDirectory("your/path/to/.huggingface"));;

Use System Environment Variables

Use your system's environment variables specify an api key to use.

  • Use HUGGING_FACE_API_KEY for your api key.
var api = new HuggingFaceClient(new HuggingFaceAuthentication().LoadFromEnvironment());

Hub

TODO

Inference

TODO

com.rest.huggingface's People

Contributors

stephenhodgson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

diannt

com.rest.huggingface's Issues

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.