Spaces:
Runtime error
Runtime error
Modfiededition
commited on
Commit
β’
8866ca4
1
Parent(s):
a099f3e
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import streamlit as st
|
2 |
import transformers
|
3 |
import tensorflow
|
4 |
-
|
5 |
|
6 |
from transformers import pipeline
|
7 |
|
@@ -16,22 +16,24 @@ model = load_model()
|
|
16 |
|
17 |
#prompts
|
18 |
st.title("Writing Assistant for you π¦")
|
19 |
-
|
|
|
|
|
20 |
example_1 = st.button("I am write on AI")
|
21 |
example_2 = st.button("This sentence has, bads grammar mistake!")
|
22 |
|
23 |
-
textbox = st.text_area('Write your text in this box:', '', height=
|
24 |
|
25 |
button = st.button('Detect grammar mistakes:')
|
26 |
|
27 |
# output
|
28 |
if example_1:
|
29 |
output_text = model("I am write on AI")[0]["generated_text"]
|
30 |
-
st.
|
31 |
|
32 |
if example_2:
|
33 |
output_text = model("This sentence has, bads grammar mistake!")[0]["generated_text"]
|
34 |
-
st.
|
35 |
if button:
|
36 |
output_text = model(textbox)[0]["generated_text"]
|
37 |
-
st.
|
|
|
1 |
import streamlit as st
|
2 |
import transformers
|
3 |
import tensorflow
|
4 |
+
from PIL import Image
|
5 |
|
6 |
from transformers import pipeline
|
7 |
|
|
|
16 |
|
17 |
#prompts
|
18 |
st.title("Writing Assistant for you π¦")
|
19 |
+
image = Image.open('grammar.jpg')
|
20 |
+
st.image(image, caption='Sunrise by the mountains')
|
21 |
+
st.subheader("Some examples: ")
|
22 |
example_1 = st.button("I am write on AI")
|
23 |
example_2 = st.button("This sentence has, bads grammar mistake!")
|
24 |
|
25 |
+
textbox = st.text_area('Write your text in this box:', '', height=100, max_chars=1000)
|
26 |
|
27 |
button = st.button('Detect grammar mistakes:')
|
28 |
|
29 |
# output
|
30 |
if example_1:
|
31 |
output_text = model("I am write on AI")[0]["generated_text"]
|
32 |
+
st.markdown("**"+output_text+"**")
|
33 |
|
34 |
if example_2:
|
35 |
output_text = model("This sentence has, bads grammar mistake!")[0]["generated_text"]
|
36 |
+
st.markdown("**"+output_text+"**")
|
37 |
if button:
|
38 |
output_text = model(textbox)[0]["generated_text"]
|
39 |
+
st.markdown("**"+output_text+"**")
|