sashtech commited on
Commit
e4351cc
1 Parent(s): 64dfde4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -7
app.py CHANGED
@@ -1,7 +1,26 @@
1
- pydantic==1.8.0 # Ensure pydantic 1.9.0 is installed to avoid V2-related errors
2
- spacy==3.5.0 # Compatible with en_core_web_sm
3
- en_core_web_sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.5.0/en_core_web_sm-3.5.0.tar.gz
4
- transformers
5
- torch
6
- gradio
7
- errant
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from gramformer import Gramformer
3
+
4
+ # Initialize the Gramformer model (using default settings for now)
5
+ gf = Gramformer(models=1, use_gpu=False)
6
+
7
+ def correct_grammar(text):
8
+ # Correct the input text using Gramformer
9
+ corrected_sentences = gf.correct(text)
10
+ return " ".join(corrected_sentences)
11
+
12
+ # Gradio Interface
13
+ def main():
14
+ interface = gr.Interface(
15
+ fn=correct_grammar,
16
+ inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
17
+ outputs="text",
18
+ title="Grammar Correction App",
19
+ description="This app corrects grammar using the Gramformer model. Enter a sentence to correct its grammar.",
20
+ )
21
+
22
+ # Launch the Gradio interface
23
+ interface.launch()
24
+
25
+ if __name__ == "__main__":
26
+ main()