Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,26 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|