3v324v23 commited on
Commit
85cf264
Β·
1 Parent(s): abfe050

Initial commit

Browse files
Files changed (1) hide show
  1. app.py +38 -37
app.py CHANGED
@@ -14,7 +14,8 @@ import time
14
  import os
15
 
16
  def start_server():
17
- os.system("python -m spacy download en_core_web_sm")
 
18
  os.system("uvicorn InferenceServer:app --port 8080 --host 0.0.0.0 --workers 1")
19
 
20
  def load_models():
@@ -161,43 +162,43 @@ def get_correction(input_text):
161
 
162
 
163
  if __name__ == "__main__":
164
- if not st.session_state['models_loaded']:
165
- load_models()
166
-
167
 
168
- st.title('Gramformer')
169
- st.subheader('A framework for correcting english grammatical errors')
170
- st.markdown("Built for fun with πŸ’™ by 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)
171
-
172
- examples = [
173
- "what be the reason for everyone leave the comapny",
174
- "The girls's backpacks are gone in the morning",
175
- "I am doing fine. How is you?",
176
- "Each of you all should run fast",
177
- "Matt like fish",
178
- "the collection of letters was original used by the ancient Romans",
179
- "We enjoys horror movies",
180
- "Anna and Mike is going skiing",
181
- "I walk to the store and I bought milk",
182
- " We all eat the fish and then made dessert",
183
- "I will eat fish for dinner and drank milk",
184
- ]
185
-
186
- nlp = spacy.load('en_core_web_sm')
187
- annotator = errant.load('en', nlp)
188
-
189
- input_text = st.selectbox(
190
- label="Choose an example",
191
- options=examples
192
- )
193
- st.write("(or)")
194
- input_text = st.text_input(
195
- label="Bring your own sentence",
196
- value=input_text
197
- )
198
-
199
- if input_text.strip():
200
- get_correction(input_text)
 
 
 
201
 
202
 
203
 
 
14
  import os
15
 
16
  def start_server():
17
+ os.system("python -m spacy download en_core_web_sm")
18
+ spacy.load('en_core_web_sm')
19
  os.system("uvicorn InferenceServer:app --port 8080 --host 0.0.0.0 --workers 1")
20
 
21
  def load_models():
 
162
 
163
 
164
  if __name__ == "__main__":
 
 
 
165
 
166
+ st.title('Gramformer')
167
+ st.subheader('A framework for correcting english grammatical errors')
168
+ st.markdown("Built for fun with πŸ’™ by 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)
169
+
170
+ examples = [
171
+ "what be the reason for everyone leave the comapny",
172
+ "The girls's backpacks are gone in the morning",
173
+ "I am doing fine. How is you?",
174
+ "Each of you all should run fast",
175
+ "Matt like fish",
176
+ "the collection of letters was original used by the ancient Romans",
177
+ "We enjoys horror movies",
178
+ "Anna and Mike is going skiing",
179
+ "I walk to the store and I bought milk",
180
+ " We all eat the fish and then made dessert",
181
+ "I will eat fish for dinner and drank milk",
182
+ ]
183
+
184
+ if not st.session_state['models_loaded']:
185
+ load_models()
186
+
187
+ nlp = spacy.load('en_core_web_sm')
188
+ annotator = errant.load('en', nlp)
189
+
190
+ input_text = st.selectbox(
191
+ label="Choose an example",
192
+ options=examples
193
+ )
194
+ st.write("(or)")
195
+ input_text = st.text_input(
196
+ label="Bring your own sentence",
197
+ value=input_text
198
+ )
199
+
200
+ if input_text.strip():
201
+ get_correction(input_text)
202
 
203
 
204