Spaces:
Runtime error
Runtime error
siddhantuniyal
commited on
Commit
•
10bc260
1
Parent(s):
4e66ed1
Update app.py
Browse files
app.py
CHANGED
@@ -1,25 +1,19 @@
|
|
1 |
|
2 |
-
from
|
3 |
-
import torch
|
4 |
import gradio as gr
|
5 |
|
6 |
-
def set_seed(seed):
|
7 |
-
torch.manual_seed(seed)
|
8 |
-
if torch.cuda.is_available():
|
9 |
-
torch.cuda.manual_seed_all(seed)
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
|
|
14 |
|
15 |
def correct(text):
|
16 |
sentences = text.split(".")
|
17 |
output = ""
|
18 |
for sentence in sentences:
|
19 |
sentence += "."
|
20 |
-
|
21 |
-
for corrected in correctedSet:
|
22 |
-
output += corrected
|
23 |
return output
|
24 |
|
25 |
iface = gr.Interface(
|
@@ -31,3 +25,6 @@ iface = gr.Interface(
|
|
31 |
|
32 |
# Launch the Gradio interface
|
33 |
iface.launch(share=True)
|
|
|
|
|
|
|
|
1 |
|
2 |
+
from transformers import pipeline
|
|
|
3 |
import gradio as gr
|
4 |
|
|
|
|
|
|
|
|
|
5 |
|
6 |
+
corrector = pipeline(
|
7 |
+
'text2text-generation',
|
8 |
+
'pszemraj/flan-t5-large-grammar-synthesis',
|
9 |
+
)
|
10 |
|
11 |
def correct(text):
|
12 |
sentences = text.split(".")
|
13 |
output = ""
|
14 |
for sentence in sentences:
|
15 |
sentence += "."
|
16 |
+
output += corrector(sentence)
|
|
|
|
|
17 |
return output
|
18 |
|
19 |
iface = gr.Interface(
|
|
|
25 |
|
26 |
# Launch the Gradio interface
|
27 |
iface.launch(share=True)
|
28 |
+
|
29 |
+
|
30 |
+
|