Spaces:
Runtime error
Runtime error
File size: 904 Bytes
12a97aa 10d2892 7d27ca1 10d2892 12a97aa |
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 27 28 29 30 31 |
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)
|