File size: 623 Bytes
0c6c2e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import gradio as gr
from transformers import pipeline

model_ckpt = "HenryAI/KerasBERTv1"
fill_mask = pipeline("fill-mask", model=model_ckpt)  


def  cloze_task(text):
    preds = fill_mask(text)     
    return preds
    
    
answer = []      
description="Let's see if BERT has learnt how to write Keras!"
title="Keras BERT v1",
gradio_ui = gr.Interface(fn= cloze_task,
    title= title, description = description,
    inputs=[gr.inputs.Textbox(lines=3)],
    outputs=[gr.outputs.Textbox(label="Answer"),],
    examples=[["from tensorflow.keras import [MASK]"],],
    enable_queue=True
)
gradio_ui.launch(debug=True)