Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,34 +1,7 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
spacy.load("en_core_web_sm")
|
9 |
-
except OSError:
|
10 |
-
subprocess.run(["python", "-m", "spacy", "download", "en_core_web_sm"])
|
11 |
-
|
12 |
-
# Initialize the Gramformer model (using default settings for now)
|
13 |
-
gf = Gramformer(models=1, use_gpu=False)
|
14 |
-
|
15 |
-
def correct_grammar(text):
|
16 |
-
# Correct the input text using Gramformer
|
17 |
-
corrected_sentences = gf.correct(text)
|
18 |
-
return " ".join(corrected_sentences)
|
19 |
-
|
20 |
-
# Gradio Interface
|
21 |
-
def main():
|
22 |
-
interface = gr.Interface(
|
23 |
-
fn=correct_grammar,
|
24 |
-
inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
|
25 |
-
outputs="text",
|
26 |
-
title="Grammar Correction App",
|
27 |
-
description="This app corrects grammar using the Gramformer model. Enter a sentence to correct its grammar.",
|
28 |
-
)
|
29 |
-
|
30 |
-
# Launch the Gradio interface
|
31 |
-
interface.launch()
|
32 |
-
|
33 |
-
if __name__ == "__main__":
|
34 |
-
main()
|
|
|
1 |
+
pydantic==1.7.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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|