KerasBERTv1 / app.py
merve's picture
merve HF Staff
Update app.py
4efcf2e
raw
history blame
636 Bytes
import gradio as gr
import torch
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",
interface = 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
)
interface.launch(debug=True)