GithubHelp home page GithubHelp logo

unity-api's Introduction

Hugging Face API Unity Integration

This Unity package provides an easy-to-use integration for the Hugging Face Inference API, allowing developers to access and use Hugging Face AI models within their Unity projects.

Table of Contents

  1. Installation
  2. Usage
  3. Tasks
  4. Support

Installation

Via Git URL

  1. Open the Unity project you want to add the package to.
  2. Go to "Window" > "Package Manager" to open the Package Manager.
  3. Click the "+" in the upper left hand corner and select "Add package from git URL".
  4. Enter the URL of this repository and click "Add": https://github.com/huggingface/unity-api.git

Usage

Configuration

After installation, the Hugging Face API wizard should open. If not, open it by clicking "Window" > "Hugging Face API Wizard".

  1. Enter your API key. Generate keys at: https://huggingface.co/settings/tokens
  2. Test the API key.
  3. Optionally, update the endpoints to use different models.

Example Scene

To try the included example scene, follow these steps:

  1. Click "Install Examples" in the Hugging Face API Wizard to copy the example files into your project.
  2. Navigate to the "Hugging Face API" > "Examples" > "Scenes" folder in your project.
  3. Open the "ConversationExample" scene.
  4. If prompted by the TMP Importer, click "Import TMP Essentials".
  5. Press "Play" to run the example. You should be able to use the UI to interact with the model.

API Usage in Scripts

The package includes a HuggingFaceAPI class that you can use from your scripts.

  1. Import the HuggingFace.API namespace in your script.
  2. Call the API method for the task you want.
using HuggingFace.API;

HuggingFaceAPI.TextToImage("a cat in a hat", result => {
    // Do something with the result, which in this case is a Texture2D
}, error => {
    // Handle errors
    Debug.LogError(error);
});

For a more advanced scripting example, refer to the included example scripts.

Tasks

Task Status
Conversation [x]
Text Generation [x]
Text to Image [x]
Text Classification [x]
Question Answering [x]
Translation [x]
Summarization [x]
Sentence Similarity [x]
Speech Recognition [x]

[x] Implemented.

Support

If you encounter issues or have questions about the package, open an issue on the repository, or ping me (@IndividualKex) on discord.

unity-api's People

Contributors

dylanebert avatar simoninithomas avatar stephenhodgson 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.