File size: 1,195 Bytes
2d9073f
 
 
 
 
 
 
 
 
 
 
 
 
 
f20ce1e
2d9073f
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import os
import sys
import requests
import gradio as gr 

def translate(input_txt,prefix,suffix,beam_size,top_k):
    output_txt = "this is test"
    return output_txt

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: "
#self.prefix = "Translate from English to German:\nEnglish: "
suffix = "\nGerman: "
iface = gr.Interface(
        fn=translate,
        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 - Change here to control"),gr.Textbox(lines=5, 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)],
        outputs=gr.Textbox(lines=1,placeholder="Enter your inputs and click submit!",label="LLM Guided NLLB German Translation"),
        title="Ensemble Decoding with NLLB 3.3B and LLama2 13B for Guided Decoding",
        )
    
iface.launch(share=True)