Spaces:
Sleeping
Sleeping
Merge remote-tracking branch 'refs/remotes/origin/main'
Browse files- .gitignore +1 -3
- README.md +33 -11
- requirements.txt +1 -1
.gitignore
CHANGED
|
@@ -1,3 +1 @@
|
|
| 1 |
-
translator_app/.venv
|
| 2 |
-
translator_app
|
| 3 |
-
translator_app/db.sqlite3
|
|
|
|
| 1 |
+
translator_app/.venv
|
|
|
|
|
|
README.md
CHANGED
|
@@ -1,11 +1,33 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
-
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The Translator App
|
| 2 |
+
|
| 3 |
+
## Run locally
|
| 4 |
+
|
| 5 |
+
```bash
|
| 6 |
+
cd translator_app
|
| 7 |
+
python -m venv .venv
|
| 8 |
+
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
| 9 |
+
pip install -r ../requirements.txt
|
| 10 |
+
python manage.py migrate
|
| 11 |
+
python manage.py runserver
|
| 12 |
+
```
|
| 13 |
+
|
| 14 |
+
Open http://127.0.0.1:8000/. The translation page has an API-backed submit
|
| 15 |
+
flow, language selectors, model picker, and persisted history at `/history/`.
|
| 16 |
+
|
| 17 |
+
## Configure a provider
|
| 18 |
+
|
| 19 |
+
Create `translator_app/.env` with a Hugging Face token before translating:
|
| 20 |
+
|
| 21 |
+
```env
|
| 22 |
+
HF_TOKEN=hf_your_access_token
|
| 23 |
+
TRANSLATION_DEFAULT_MODEL=nllb_600m
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
The primary model picker is configured for NLLB-200 600M, NLLB-200 1.3B, and
|
| 27 |
+
MADLAD-400 3B through Hugging Face Inference Providers. NLLB language codes
|
| 28 |
+
are mapped in the service before a request is sent. The selected model is sent
|
| 29 |
+
by the UI and saved with each history item.
|
| 30 |
+
|
| 31 |
+
For an optional DeepL-compatible fallback, additionally set
|
| 32 |
+
`TRANSLATION_API_KEY` (and optionally `TRANSLATION_API_URL`). It will appear in
|
| 33 |
+
the model picker only when configured.
|
requirements.txt
CHANGED
|
@@ -2,4 +2,4 @@ Django>=5.2
|
|
| 2 |
djangorestframework>=3.15
|
| 3 |
python-dotenv>=1.0
|
| 4 |
requests>=2.31
|
| 5 |
-
langdetect>=1.0.9
|
|
|
|
| 2 |
djangorestframework>=3.15
|
| 3 |
python-dotenv>=1.0
|
| 4 |
requests>=2.31
|
| 5 |
+
langdetect>=1.0.9
|