edaiofficial commited on
Commit
b51f7b9
·
1 Parent(s): 2f54e99

additional commits

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -49,10 +49,11 @@ def load_model(source_language_,target_language_):
49
 
50
  params = load_params_for_prediction(parsed_yaml_file,best_ckpt)
51
  return params
52
-
53
- #Using global params for English and Swahili to save time taken to load them
 
54
  params = load_model('English','Swahili')
55
-
56
  def get_translation(source_language,target_language,source_sentence=None,source_file=None):
57
  '''
58
  This takes a sentence and gets the translation.
@@ -64,7 +65,8 @@ def get_translation(source_language,target_language,source_sentence=None,source_
64
  type_=1
65
  source = source_file.name
66
  try:
67
- #params = load_model(source_language,target_language) #Using global params for English and Swahili to save time taken to load them
 
68
 
69
  pred = translate(params,source,type_)
70
  except Exception:
 
49
 
50
  params = load_params_for_prediction(parsed_yaml_file,best_ckpt)
51
  return params
52
+ '''
53
+ #Using global params for English and Swahili (default pairs for this demo) to save time taken to load them.
54
+ params=None
55
  params = load_model('English','Swahili')
56
+ '''
57
  def get_translation(source_language,target_language,source_sentence=None,source_file=None):
58
  '''
59
  This takes a sentence and gets the translation.
 
65
  type_=1
66
  source = source_file.name
67
  try:
68
+
69
+ params = load_model(source_language,target_language) #Uncomment when not Using global params for English and Swahili to save time taken to load them
70
 
71
  pred = translate(params,source,type_)
72
  except Exception: