san2deep/FillMask
0
1import streamlit as st2from transformers import pipeline3 4# Title for the app5st.title('Fill in the Blank Bot')6 7# Load the fill-mask pipeline8fill_mask = pipeline('fill-mask')9 10# Text area for the user input11user_input = st.text_area("Enter a sentence with a <mask> in place of the missing word")12 13# Button to trigger the fill-mask function14if st.button('Fill the Blank'):15 # Predict the missing words16 results = fill_mask(user_input)17 18 # Display the top 5 predictions19 st.write("Top predictions:")20 for result in results:21 st.write(f"Prediction: {result['token_str']}, Confidence: {round(result['score'], 4)}")22 