Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import spacy
|
|
5 |
import streamlit as st
|
6 |
from happytransformer import HappyTextToText, TTSettings
|
7 |
|
8 |
-
from highlighter import
|
9 |
|
10 |
checkpoints = [
|
11 |
"aseifert/t5-base-jfleg-wi",
|
@@ -33,21 +33,6 @@ def get_annotator(lang: str):
|
|
33 |
return errant.load(lang)
|
34 |
|
35 |
|
36 |
-
def output(model, args, annotator, input_text):
|
37 |
-
with st.spinner("Checking for errors π"):
|
38 |
-
prefixed_input_text = "Grammar: " + input_text
|
39 |
-
result = model.generate_text(prefixed_input_text, args=args).text
|
40 |
-
|
41 |
-
try:
|
42 |
-
show_highlights(annotator, input_text, result)
|
43 |
-
st.write("")
|
44 |
-
st.success(result)
|
45 |
-
# st.table(show_edits(annotator, input_text, result))
|
46 |
-
except Exception as e:
|
47 |
-
st.error("Some error occured!" + str(e))
|
48 |
-
st.stop()
|
49 |
-
|
50 |
-
|
51 |
def main():
|
52 |
st.title("π€ Writing Assistant")
|
53 |
st.markdown(
|
@@ -70,15 +55,26 @@ def main():
|
|
70 |
start = None
|
71 |
if st.button("βοΈ Check"):
|
72 |
start = time.time()
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
st.write("---")
|
76 |
st.markdown(
|
77 |
-
|
78 |
)
|
79 |
st.markdown(
|
80 |
-
|
81 |
)
|
|
|
82 |
if start is not None:
|
83 |
st.text(f"prediction took {time.time() - start:.2f}s")
|
84 |
|
|
|
5 |
import streamlit as st
|
6 |
from happytransformer import HappyTextToText, TTSettings
|
7 |
|
8 |
+
from highlighter import show_highlights
|
9 |
|
10 |
checkpoints = [
|
11 |
"aseifert/t5-base-jfleg-wi",
|
|
|
33 |
return errant.load(lang)
|
34 |
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
def main():
|
37 |
st.title("π€ Writing Assistant")
|
38 |
st.markdown(
|
|
|
55 |
start = None
|
56 |
if st.button("βοΈ Check"):
|
57 |
start = time.time()
|
58 |
+
with st.spinner("Checking for errors π"):
|
59 |
+
prefixed_input_text = "Grammar: " + input_text
|
60 |
+
result = model.generate_text(prefixed_input_text, args=args).text
|
61 |
+
|
62 |
+
try:
|
63 |
+
show_highlights(annotator, input_text, result)
|
64 |
+
st.write("")
|
65 |
+
st.success(result)
|
66 |
+
except Exception as e:
|
67 |
+
st.error("Some error occured!" + str(e))
|
68 |
+
st.stop()
|
69 |
|
70 |
st.write("---")
|
71 |
st.markdown(
|
72 |
+
"Built by [@aseifert](https://twitter.com/therealaseifert) during the HF community event β π¨\u200dπ» [GitHub repo](https://github.com/aseifert/hf-writing-assistant) β π€ Team Writing Assistant"
|
73 |
)
|
74 |
st.markdown(
|
75 |
+
"_Highlighting code thanks to [Gramformer](https://github.com/PrithivirajDamodaran/Gramformer)_"
|
76 |
)
|
77 |
+
|
78 |
if start is not None:
|
79 |
st.text(f"prediction took {time.time() - start:.2f}s")
|
80 |
|