zionia commited on
Commit
dade706
1 Parent(s): 6effff6

update to ss

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -1,11 +1,11 @@
1
  import gradio as gr
2
  from transformers import M2M100ForConditionalGeneration, M2M100Tokenizer
3
 
4
- model_name = "dsfsi/nso-en-m2m100-gov"
5
  tokenizer = M2M100Tokenizer.from_pretrained(model_name)
6
  model = M2M100ForConditionalGeneration.from_pretrained(model_name)
7
 
8
- tokenizer.src_lang = "nso"
9
 
10
  model.config.forced_bos_token_id = tokenizer.get_lang_id("en")
11
 
@@ -20,11 +20,11 @@ def translate(inp):
20
  description = """
21
  <p>
22
  <center>
23
- Northern Sotho to English Translation
24
  </center>
25
  </p>
26
  """
27
- article = "<p style='text-align: center'><a href='https://huggingface.co/dsfsi/nso-en-m2m100-gov' target='_blank'>by dsfsi</a></p>"
28
 
29
  examples = [
30
  ["Ngiyabonga kakhulu ngesipho osinike sona."],
@@ -33,14 +33,13 @@ examples = [
33
 
34
  iface = gr.Interface(
35
  fn=translate,
36
- title="Northern Sotho to English Translation",
37
  description=description,
38
  article=article,
39
  examples=examples,
40
- inputs=gr.components.Textbox(lines=5, placeholder="Enter Northern Sotho text (maximum 5 lines)", label="Input"),
41
  outputs="text"
42
  )
43
 
44
  iface.launch(enable_queue=True)
45
 
46
-
 
1
  import gradio as gr
2
  from transformers import M2M100ForConditionalGeneration, M2M100Tokenizer
3
 
4
+ model_name = "dsfsi/ss-en-m2m100-gov"
5
  tokenizer = M2M100Tokenizer.from_pretrained(model_name)
6
  model = M2M100ForConditionalGeneration.from_pretrained(model_name)
7
 
8
+ tokenizer.src_lang = "ss"
9
 
10
  model.config.forced_bos_token_id = tokenizer.get_lang_id("en")
11
 
 
20
  description = """
21
  <p>
22
  <center>
23
+ Siswati to English Translation
24
  </center>
25
  </p>
26
  """
27
+ article = "<p style='text-align: center'><a href='https://huggingface.co/dsfsi/ss-en-m2m100-gov' target='_blank'>by dsfsi</a></p>"
28
 
29
  examples = [
30
  ["Ngiyabonga kakhulu ngesipho osinike sona."],
 
33
 
34
  iface = gr.Interface(
35
  fn=translate,
36
+ title="🌸Siswati to English Translation🌸",
37
  description=description,
38
  article=article,
39
  examples=examples,
40
+ inputs=gr.components.Textbox(lines=5, placeholder="Enter Siswati text (maximum 5 lines)", label="Input"),
41
  outputs="text"
42
  )
43
 
44
  iface.launch(enable_queue=True)
45