import streamlit as st import transformers import tensorflow import PIL from PIL import Image import time from transformers import pipeline model_checkpoint = "Modfiededition/t5-base-fine-tuned-on-jfleg" @st.cache(allow_output_mutation=True, suppress_st_warning=True) def load_model(): return pipeline("text2text-generation", model=model_checkpoint) model = load_model() st.subheader("당신의 영어 일기장을 위해! 🤖") st.markdown("최고의 성능으로 문법을 체크해 드립니다.!") textbox = st.text_area('Write your text in this box:', '',height=10, max_chars=300 ) button = st.button('Detect grammar mistakes:') # output st.subheader("Correct sentence: ") if button: with st.spinner('In progress.......'): if textbox: output_text = model(textbox)[0]["generated_text"] else: output_text = " " st.markdown("## "+output_text)