Spaces:
Runtime error
Runtime error
Initial test
Browse files
app.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import sys
|
| 3 |
+
import requests
|
| 4 |
+
import gradio as gr
|
| 5 |
+
|
| 6 |
+
def translate(input_txt,prefix,suffix,beam_size,top_k):
|
| 7 |
+
output_txt = "this is test"
|
| 8 |
+
return output_txt
|
| 9 |
+
|
| 10 |
+
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: "
|
| 11 |
+
#self.prefix = "Translate from English to German:\nEnglish: "
|
| 12 |
+
suffix = "\nGerman: "
|
| 13 |
+
iface = gr.Interface(
|
| 14 |
+
fn=translate,
|
| 15 |
+
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',default=5,min=1,max=5,step=1),gr.Slider(label="TopK for rescoring",default=5,min=5,max=10,step=1)],
|
| 16 |
+
outputs=gr.Textbox(lines=1,placeholder="Enter your inputs and click submit!",label="LLM Guided NLLB German Translation"),
|
| 17 |
+
title="Ensemble Decoding with NLLB 3.3B and LLama2 13B for Guided Decoding",
|
| 18 |
+
description=description,
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
iface.launch(share=True)
|