kadirnar commited on
Commit
5ee913f
1 Parent(s): 6dff55f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -13,9 +13,10 @@ model_list = [
13
  lang_list = list(lang_ids.keys())
14
 
15
  def translate_to_english(text, base_lang):
16
- if base_lang == "en":
17
  return text
18
  else:
 
19
  new_text = translate("facebook/m2m100_418M", text, base_lang, "en")
20
  return new_text
21
 
@@ -29,6 +30,7 @@ def biogpt(
29
  ):
30
 
31
  en_prompt = translate_to_english(prompt, base_lang)
 
32
  model = BioGptForCausalLM.from_pretrained(model_id)
33
  tokenizer = BioGptTokenizer.from_pretrained(model_id)
34
  generator = pipeline('text-generation', model=model, tokenizer=tokenizer)
 
13
  lang_list = list(lang_ids.keys())
14
 
15
  def translate_to_english(text, base_lang):
16
+ if base_lang == "English":
17
  return text
18
  else:
19
+ base_lang = lang_ids[base_lang]
20
  new_text = translate("facebook/m2m100_418M", text, base_lang, "en")
21
  return new_text
22
 
 
30
  ):
31
 
32
  en_prompt = translate_to_english(prompt, base_lang)
33
+
34
  model = BioGptForCausalLM.from_pretrained(model_id)
35
  tokenizer = BioGptTokenizer.from_pretrained(model_id)
36
  generator = pipeline('text-generation', model=model, tokenizer=tokenizer)