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)