libretranslate / README.md
SakibAhmed's picture
Upload 2 files
2361fea verified
|
Raw
History Blame Contribute Delete
1.1 kB
metadata
title: LibreTranslate CPU API
emoji: 🌐
colorFrom: blue
colorTo: green
sdk: docker
app_port: 7860
pinned: false
license: agpl-3.0
short_description: Self-hosted LibreTranslate API on Hugging Face Spaces CPU

LibreTranslate CPU API on Hugging Face Spaces

This Space runs LibreTranslate as a Docker Space.

API test

Replace YOUR_USERNAME and YOUR_SPACE_NAME with your Hugging Face username and Space name.

curl -X POST "https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space/translate" \
  -H "Content-Type: application/json" \
  -d '{"q":"Hello friend","source":"en","target":"pl","format":"text"}'

Expected response:

{
  "translatedText": "Witaj przyjacielu"
}

Loaded languages

This template loads only these languages to reduce CPU/RAM use:

  • English: en
  • Polish: pl
  • Russian: ru
  • Spanish: es
  • French: fr
  • German: de
  • Korean: ko

To change this, edit LT_LOAD_ONLY in Dockerfile.

Important

Free Hugging Face Spaces can sleep after inactivity. First request after sleep can be slow because LibreTranslate has to start again.