Spaces:
Running
Running
Initial commit
Browse files
app.py
CHANGED
@@ -1,19 +1,7 @@
|
|
1 |
-
from annotated_text import annotated_text
|
2 |
-
from bs4 import BeautifulSoup
|
3 |
-
from multiprocessing import Process
|
4 |
import streamlit as st
|
5 |
-
|
6 |
-
import torch
|
7 |
-
import math
|
8 |
-
import re
|
9 |
import time
|
10 |
-
import json
|
11 |
import os
|
12 |
-
import requests
|
13 |
-
import spacy
|
14 |
-
import errant
|
15 |
-
|
16 |
-
|
17 |
|
18 |
def start_server():
|
19 |
os.system("cat custom_req.txt | xargs -n 1 -L 1 pip install -U")
|
@@ -172,40 +160,52 @@ if __name__ == "__main__":
|
|
172 |
if not st.session_state['models_loaded']:
|
173 |
load_models()
|
174 |
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
209 |
|
210 |
|
211 |
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
+
from multiprocessing import Process
|
|
|
|
|
|
|
3 |
import time
|
|
|
4 |
import os
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
def start_server():
|
7 |
os.system("cat custom_req.txt | xargs -n 1 -L 1 pip install -U")
|
|
|
160 |
if not st.session_state['models_loaded']:
|
161 |
load_models()
|
162 |
|
163 |
+
from annotated_text import annotated_text
|
164 |
+
from bs4 import BeautifulSoup
|
165 |
+
import pandas as pd
|
166 |
+
import torch
|
167 |
+
import math
|
168 |
+
import re
|
169 |
+
import json
|
170 |
+
import requests
|
171 |
+
import spacy
|
172 |
+
import errant
|
173 |
+
|
174 |
+
|
175 |
+
|
176 |
+
st.title('Gramformer')
|
177 |
+
st.subheader('A framework for correcting english grammatical errors')
|
178 |
+
st.markdown("Built for fun with π by a quintessential foodie - Prithivi Da, The maker of [WhatTheFood](https://huggingface.co/spaces/prithivida/WhatTheFood), [Styleformer](https://github.com/PrithivirajDamodaran/Styleformer) and [Parrot paraphraser](https://github.com/PrithivirajDamodaran/Parrot_Paraphraser) | βοΈ [@prithivida](https://twitter.com/prithivida) |[[GitHub]](https://github.com/PrithivirajDamodaran)", unsafe_allow_html=True)
|
179 |
+
|
180 |
+
examples = [
|
181 |
+
"what be the reason for everyone leave the comapny",
|
182 |
+
"He are moving here.",
|
183 |
+
"I am doing fine. How is you?",
|
184 |
+
"How is they?",
|
185 |
+
"Matt like fish",
|
186 |
+
"the collection of letters was original used by the ancient Romans",
|
187 |
+
"We enjoys horror movies",
|
188 |
+
"Anna and Mike is going skiing",
|
189 |
+
"I walk to the store and I bought milk",
|
190 |
+
" We all eat the fish and then made dessert",
|
191 |
+
"I will eat fish for dinner and drink milk",
|
192 |
+
]
|
193 |
+
|
194 |
+
nlp = spacy.load('en_core_web_sm')
|
195 |
+
annotator = errant.load('en', nlp)
|
196 |
+
|
197 |
+
input_text = st.selectbox(
|
198 |
+
label="Choose an example",
|
199 |
+
options=examples
|
200 |
+
)
|
201 |
+
st.write("(or)")
|
202 |
+
input_text = st.text_input(
|
203 |
+
label="Enter your own text",
|
204 |
+
value=input_text
|
205 |
+
)
|
206 |
+
|
207 |
+
if input_text.strip():
|
208 |
+
get_correction(input_text)
|
209 |
|
210 |
|
211 |
|