kadirnar commited on
Commit
a906b66
1 Parent(s): 6499eee
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -39,22 +39,23 @@ def biogpt(
39
  generator = pipeline('text-generation', model=model, tokenizer=tokenizer)
40
  set_seed(42)
41
  output = generator(en_prompt, max_length=max_length, num_return_sequences=num_return_sequences, do_sample=True)
42
-
43
  output_dict = {}
44
  for i in range(num_return_sequences):
45
  output_dict[str(i+1)] = output[i]['generated_text']
46
-
47
  output_text = ""
48
  for i in range(num_return_sequences):
49
  output_text += f'{output_dict[str(i+1)]}\n\n'
50
-
51
  if base_lang == "English":
52
  base_lang_output = output_text
53
 
54
  else:
55
- base_lang_output = translate(lang_model_id, output_text, "en", lang_ids[base_lang])[0]
56
  for i in range(num_return_sequences):
57
- base_lang_output += f'{output_dict[str(i+1)]}\n\n'
 
 
58
 
59
  return en_prompt, output_text, base_lang_output
60
 
 
39
  generator = pipeline('text-generation', model=model, tokenizer=tokenizer)
40
  set_seed(42)
41
  output = generator(en_prompt, max_length=max_length, num_return_sequences=num_return_sequences, do_sample=True)
 
42
  output_dict = {}
43
  for i in range(num_return_sequences):
44
  output_dict[str(i+1)] = output[i]['generated_text']
45
+
46
  output_text = ""
47
  for i in range(num_return_sequences):
48
  output_text += f'{output_dict[str(i+1)]}\n\n'
49
+
50
  if base_lang == "English":
51
  base_lang_output = output_text
52
 
53
  else:
54
+ base_lang_output_ = ""
55
  for i in range(num_return_sequences):
56
+ base_lang_output_ += f'{translate(lang_model_id, output_dict[str(i+1)], "en", lang_ids[base_lang])[0]}\n\n'
57
+ base_lang_output = base_lang_output_
58
+
59
 
60
  return en_prompt, output_text, base_lang_output
61