Spaces:
Sleeping
Sleeping
enforce the usage of the hf token
Browse files
src/salamandraTA7b_translator.py
CHANGED
|
@@ -1,11 +1,9 @@
|
|
| 1 |
from gradio_client import Client
|
| 2 |
from iso639 import languages
|
| 3 |
|
| 4 |
-
HF_TOKEN = "YOUR-HF-TOKEN-HERE"
|
| 5 |
-
|
| 6 |
class SalamandraTA7bTranslator:
|
| 7 |
-
def __init__(self):
|
| 8 |
-
self.client = Client("BSC-LT/SalamandraTA-7B-Demo", hf_token=
|
| 9 |
|
| 10 |
def translate(self, text, source_lang, target_lang):
|
| 11 |
# we assume that they are specifying the language by code so we need to convert it to name
|
|
|
|
| 1 |
from gradio_client import Client
|
| 2 |
from iso639 import languages
|
| 3 |
|
|
|
|
|
|
|
| 4 |
class SalamandraTA7bTranslator:
|
| 5 |
+
def __init__(self, hf_token):
|
| 6 |
+
self.client = Client("BSC-LT/SalamandraTA-7B-Demo", hf_token=hf_token)
|
| 7 |
|
| 8 |
def translate(self, text, source_lang, target_lang):
|
| 9 |
# we assume that they are specifying the language by code so we need to convert it to name
|