File size: 428 Bytes
54762f8
 
ae44695
54762f8
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
from transformers import pipeline
import gradio as gr
pipe= pipeline('text2text-generation', model="facebook/m2m100_418M")
def generate_text(inp):
    output=pipe(inp, forced_bos_token_id=pipe.tokenizer.get_lang_id('bn'))
    tln=output[0]
    for item in tln:
        result=tln[item]
    return result
#Gradio Interface
output_text = gr.outputs.Textbox()
gr.Interface(generate_text,"textbox", output_text).launch(inline=False)