Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 3 min read How-to mediumAdept

How to Install and Use the Hugging Face Unity API

The Hugging Face Unity API wraps the Hugging Face Inference API so Unity projects can call hosted models. You install it via Package Manager from a git URL, then use the API Wizard to set an API key and model endpoints. A C# example shows an asynchronous sentence-similarity call with success and error callbacks. Other supported tasks include conversation, text generation, text-to-image, classification, QA, translation, summarization and speech recognition, and custom models work by swapping the endpoint URL. Slow responses can be addressed by switching to lower-resource models.

Assumes: Unity basicsC# scripting

Related posts

  • AI Speech Recognition in Unity

    Hugging Face mediumAdept

    Speech recognition can be added to a Unity game with the Hugging Face Unity API by recording microphone input, encoding it as WAV and sending it for transcription. The C# walkthrough builds start/stop buttons and records up to 10 seconds at 44.1 kHz with Microphone.Start. It truncates the clip at the stop position and hand-writes a 16-bit PCM WAV header before calling HuggingFaceAPI.AutomaticSpeechRecognition with success and error callbacks. Button interactability and status messages are added for UX. Reader comments note that the hosted inference endpoint now returns 403 or timeout errors.

  • Inference for PROs

    Hugging Face mediumAdept

    Hugging Face PRO subscribers get curated, rate-limit-boosted HTTP inference endpoints served by text-generation-inference for models such as Llama 3, Mixtral 8x7B, Zephyr, Code Llama, Stable Diffusion XL and Bark, intended for prototyping rather than heavy production (Inference Endpoints is recommended for that). Usage is shown via curl, the huggingface_hub InferenceClient and the OpenAI-compatible Messages API, including Llama 2 chat templates and Code Llama's <PRE>/<SUF>/<MID> infilling format. Generation parameters (do_sample, temperature, top_k, top_p, repetition_penalty, max_new_tokens, stop_sequences, SDXL guidance and steps) are explained, along with disabling response caching via the x-use-cache: 0 header and token streaming.

  • Showcase Your Projects in Spaces using Gradio

    Hugging Face mediumAdept

    Gradio's Hugging Face Hub integration lets you build an ML demo from a Hub model ID in a few lines: gr.Interface.load plus a title, description and example inputs, backed by the Inference API. You can host these demos for free on Hugging Face Spaces by adding an app.py, and wrap custom checkpoints in an Interface when the Inference API doesn't support them. Gradio's Series chains models together, shown here as a French story generator built from Opus MT translation models around a GPT-2 story generator.

  • Blazingly fast whisper transcriptions with Inference Endpoints

    Hugging Face easyNovice

    Hugging Face Inference Endpoints now offers a Whisper deployment built on vLLM that delivers up to roughly 8x higher real-time factor (RTFx) than the Transformers implementation, with comparable word error rate. It targets NVIDIA Ada Lovelace GPUs (L4, L40s) and gets its speedup from torch.compile JIT kernels, CUDA graphs that batch GPU kernel launches, and a float8 KV cache that halves cache memory versus bfloat16. Whisper Large V3, V3-Turbo and Distil-Whisper V3.5 were benchmarked for WER on 8 Open ASR Leaderboard datasets and for RTFx on 45+ minute rev16 audio using a single L4. Deployment is one click, and the endpoint is called through an OpenAI-style /audio/transcriptions HTTP API; a FastRTC demo shows real-time transcription.

  • Train AI models with Unsloth and Hugging Face Jobs for FREE

    Hugging Face mediumAdept

    Unsloth on Hugging Face Jobs can fine-tune small models like LiquidAI/LFM2.5-1.2B-Instruct on managed cloud GPUs. Unsloth claims ~2x faster training and ~60% less VRAM, so a run can cost a few dollars. The guide covers submitting a job directly with `hf jobs uv run` and installing a Hugging Face model-trainer skill so coding agents like Claude Code or Codex can generate a UV script, submit it, and report Trackio monitoring links. It includes an example 4-bit LoRA SFT script using TRL, GPU flavor recommendations by model size (~$0.40–$3.00/hr), and tips for prompting agents. Free credits are offered through the Unsloth Jobs Explorers organization.

The quest for software engineering knowledge.

Look:
Layout: