NLP_Tasks / app.py
DhimanBose's picture
Create app.py
913c4e5 verified
raw
history blame
462 Bytes
from transformers import pipeline
import gradio as gr
pipe = pipeline("fill-mask", model="sagorsarker/bangla-bert-base")
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()