janmoons commited on
Commit
d1919da
·
verified ·
1 Parent(s): dc41e60

Added ISO language code examples

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -9,18 +9,17 @@ from tools.final_answer import FinalAnswerTool
9
  from Gradio_UI import GradioUI
10
 
11
  @tool
12
- def translate_text(text:str, source_language:str, target_language:str="nl")-> str:
13
  """A tool that translates an input text into the preferred target language
14
  Args:
15
  text: the input text that needs to be translated
16
- source_language: the language of the input text
17
- target_language: the language the input text needs to be translated to
18
  """
19
  client = InferenceClient()
20
  return client.translation(
21
  text,
22
  model="facebook/nllb-200-1.3B",
23
- provider="hf-inference",
24
  src_lang=source_language,
25
  tgt_lang=target_language
26
  )
 
9
  from Gradio_UI import GradioUI
10
 
11
  @tool
12
+ def translate_text(text:str, source_language:str='eng_Latn', target_language:str='fr_Latn')-> str:
13
  """A tool that translates an input text into the preferred target language
14
  Args:
15
  text: the input text that needs to be translated
16
+ source_language: the language of the input text, use ISO 639-3 language code e.g. eng_Latn, fr_Latn, ...
17
+ target_language: the language the input text needs to be translated to, use ISO 639-3 language code e.g. eng_Latn, fr_Latn, ...
18
  """
19
  client = InferenceClient()
20
  return client.translation(
21
  text,
22
  model="facebook/nllb-200-1.3B",
 
23
  src_lang=source_language,
24
  tgt_lang=target_language
25
  )