Sifal commited on
Commit
9607e93
·
1 Parent(s): 2ce4922

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -207,7 +207,7 @@ def beam_search_decode(model, src, src_mask, max_len, start_symbol, beam_size ,l
207
  best_beam = beams[0][0]
208
  return best_beam
209
 
210
- def translate(model: torch.nn.Module, src_sentence: str, strategy:str = 'greedy' , lenght_extend :int = 5, beam_size: int = 5, length_penalty:float = 0.6):
211
  assert strategy in ['greedy','beam search'], 'the strategy for decoding has to be either greedy or beam search'
212
  # Tokenize the source sentence
213
  src = source_tokenizer(src_sentence, **token_config)['input_ids']
@@ -259,7 +259,7 @@ iface = gr.Interface(
259
  gr.inputs.Number(label="Length Penalty (for beam search)", default=0.6)
260
  ],
261
  outputs=gr.outputs.Textbox("Translation"),
262
- title="Translation Interface",
263
  description="Translate text using a pre-trained model.",
264
  )
265
 
 
207
  best_beam = beams[0][0]
208
  return best_beam
209
 
210
+ def translate(src_sentence: str, strategy:str = 'greedy' , lenght_extend :int = 5, beam_size: int = 5, length_penalty:float = 0.6):
211
  assert strategy in ['greedy','beam search'], 'the strategy for decoding has to be either greedy or beam search'
212
  # Tokenize the source sentence
213
  src = source_tokenizer(src_sentence, **token_config)['input_ids']
 
259
  gr.inputs.Number(label="Length Penalty (for beam search)", default=0.6)
260
  ],
261
  outputs=gr.outputs.Textbox("Translation"),
262
+ title="Translation Interface for English to Kabyle",
263
  description="Translate text using a pre-trained model.",
264
  )
265