Update app.py
Browse files
app.py
CHANGED
@@ -5,11 +5,11 @@ tokenizer = MBart50TokenizerFast.from_pretrained("SnypzZz/Llama2-13b-Language-tr
|
|
5 |
|
6 |
dropdown = gr.Dropdown(["de_DE", "es_XX"], label="Choose Output Language")
|
7 |
|
8 |
-
def d(input):
|
9 |
model_inputs = tokenizer(input, return_tensors="pt")
|
10 |
generated_tokens = model.generate(
|
11 |
**model_inputs,
|
12 |
-
forced_bos_token_id=tokenizer.lang_code_to_id[
|
13 |
)
|
14 |
output_DE = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)[0]
|
15 |
output_DE = output_DE.strip("[]' ")
|
|
|
5 |
|
6 |
dropdown = gr.Dropdown(["de_DE", "es_XX"], label="Choose Output Language")
|
7 |
|
8 |
+
def d(input, dropdown_value):
|
9 |
model_inputs = tokenizer(input, return_tensors="pt")
|
10 |
generated_tokens = model.generate(
|
11 |
**model_inputs,
|
12 |
+
forced_bos_token_id=tokenizer.lang_code_to_id[dropdown_value]
|
13 |
)
|
14 |
output_DE = tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)[0]
|
15 |
output_DE = output_DE.strip("[]' ")
|