File size: 535 Bytes
8170b20
 
913c4e5
 
303b7c1
913c4e5
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
pip install transformers
pip install gradio
from transformers import pipeline
import gradio as gr
pipe = pipeline("fill-mask", model="DhimanBose/FineTuned_BanglaBERT_for_Masked_Language_Model")


def image_classifier(inp):

    dat=pipe(inp)
    suggested_word=[]
    for x in dat:
      suggested_word.append(x['token_str']+"                    "+str(x['score']))
    return 'Word'+"                    "+'Perchantage\n'+'\n '.join(suggested_word)


demo = gr.Interface(fn=image_classifier,inputs="text", outputs="text")
demo.launch()