Spaces:
Runtime error
Runtime error
Initial test
Browse files
app.py
CHANGED
|
@@ -11,10 +11,19 @@ def translate(input_txt,prefix,suffix,num_beams,topk,beta):
|
|
| 11 |
prefix= "<s>[INST] <<SYS>>\nYou are a professional translator from English to German. You translate the sentences to only Formal German even if the English sentence is Informal.\n<</SYS>>\nEnglish: "
|
| 12 |
#self.prefix = "Translate from English to German:\nEnglish: "
|
| 13 |
suffix = "\nGerman: "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
iface = gr.Interface(
|
| 15 |
fn=translate,
|
| 16 |
inputs=[gr.Textbox(lines=1, placeholder="Enter your English Sentences that you want to translate", label="English Sentence"), gr.Textbox(lines=5, placeholder=prefix,label="Prefix for LLM Prompt - Replace formal and informal here to control Formality Levle"),gr.Textbox(lines=2, placeholder=suffix, label="DONT CHANGE!!"),gr.Slider(label='Select beam size',value=5,minimum=1,maximum=5,step=1),gr.Slider(label="TopK for rescoring",value=5,minimum=5,maximum=10,step=1),gr.Slider(label="LLM weight when rescoring, 1 for complete LLM scoring, 0 for NLLB Decoding without LLM",value=1,minimum=0,maximum=1,step=0.1)],
|
| 17 |
outputs=gr.Textbox(lines=1,placeholder="Enter your inputs and click submit!",label="LLM Guided NLLB German Translation"),
|
|
|
|
| 18 |
title="Ensemble Decoding with NLLB 3.3B and LLama2 13B for Guided Decoding",
|
| 19 |
)
|
| 20 |
|
|
|
|
| 11 |
prefix= "<s>[INST] <<SYS>>\nYou are a professional translator from English to German. You translate the sentences to only Formal German even if the English sentence is Informal.\n<</SYS>>\nEnglish: "
|
| 12 |
#self.prefix = "Translate from English to German:\nEnglish: "
|
| 13 |
suffix = "\nGerman: "
|
| 14 |
+
|
| 15 |
+
example_formal = ["Where are you going today?",prefix,suffix,5,5,1]
|
| 16 |
+
|
| 17 |
+
prefix= "<s>[INST] <<SYS>>\nYou are a professional translator from English to German. You translate the sentences to only Informal German even if the English sentence is Formal.\n<</SYS>>\nEnglish: "
|
| 18 |
+
#self.prefix = "Translate from English to German:\nEnglish: "
|
| 19 |
+
suffix = "\nGerman: "
|
| 20 |
+
example_informal = ["Where are you going today?",prefix,suffix,5,5,1]
|
| 21 |
+
|
| 22 |
iface = gr.Interface(
|
| 23 |
fn=translate,
|
| 24 |
inputs=[gr.Textbox(lines=1, placeholder="Enter your English Sentences that you want to translate", label="English Sentence"), gr.Textbox(lines=5, placeholder=prefix,label="Prefix for LLM Prompt - Replace formal and informal here to control Formality Levle"),gr.Textbox(lines=2, placeholder=suffix, label="DONT CHANGE!!"),gr.Slider(label='Select beam size',value=5,minimum=1,maximum=5,step=1),gr.Slider(label="TopK for rescoring",value=5,minimum=5,maximum=10,step=1),gr.Slider(label="LLM weight when rescoring, 1 for complete LLM scoring, 0 for NLLB Decoding without LLM",value=1,minimum=0,maximum=1,step=0.1)],
|
| 25 |
outputs=gr.Textbox(lines=1,placeholder="Enter your inputs and click submit!",label="LLM Guided NLLB German Translation"),
|
| 26 |
+
examples=[example_formal,example_informal]
|
| 27 |
title="Ensemble Decoding with NLLB 3.3B and LLama2 13B for Guided Decoding",
|
| 28 |
)
|
| 29 |
|