dla9944's picture
Update app.py
07ab5af
raw
history blame
898 Bytes
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)