ayushsinha commited on
Commit
6e38be6
·
verified ·
1 Parent(s): 57ff9d2

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +21 -0
  2. requirements.txt +4 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ def correct_grammar(sentence):
5
+ model_name = "AventIQ-AI/t5-grammar-correction"
6
+ generator = pipeline("text2text-generation", model=model_name)
7
+
8
+ result = generator(sentence, max_length=256)[0]['generated_text']
9
+
10
+ return result
11
+
12
+ iface = gr.Interface(
13
+ fn=correct_grammar,
14
+ inputs=gr.Textbox(label="Input Sentence"),
15
+ outputs=gr.Textbox(label="Corrected Sentence"),
16
+ title="T5 Grammar Correction",
17
+ description="Enter a sentence with grammar mistakes, and the model will correct it."
18
+ )
19
+
20
+ if __name__ == "__main__":
21
+ iface.launch()
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ torch
2
+ transformers
3
+ gradio
4
+ sentencepiece