Spaces:
Runtime error
Runtime error
shahzaibelbert
commited on
Commit
•
69272c0
1
Parent(s):
38621e7
Update app.py
Browse files
app.py
CHANGED
@@ -67,7 +67,7 @@ def correct_text(text: str, checker, corrector, separator: str = " ") -> str:
|
|
67 |
# Check the grammar quality of the text using the text-classification pipeline
|
68 |
results = checker(raw_text)
|
69 |
|
70 |
-
# Only correct the text if the results of the text
|
71 |
if results[0]["label"] != "LABEL_1" or (
|
72 |
results[0]["label"] == "LABEL_1" and results[0]["score"] < 0.9
|
73 |
):
|
@@ -89,16 +89,6 @@ def update(text: str):
|
|
89 |
|
90 |
|
91 |
with gr.Blocks() as demo:
|
92 |
-
gr.Markdown("# <center>Robust Grammar Correction with FLAN-T5</center>")
|
93 |
-
gr.Markdown(
|
94 |
-
"**Instructions:** Enter the text you want to correct in the textbox below (_text will be truncated to 4000 characters_). Click 'Process' to run."
|
95 |
-
)
|
96 |
-
gr.Markdown(
|
97 |
-
"""Models:
|
98 |
-
- `textattack/roberta-base-CoLA` for grammar quality detection
|
99 |
-
- `pszemraj/flan-t5-large-grammar-synthesis` for grammar correction
|
100 |
-
"""
|
101 |
-
)
|
102 |
with gr.Row():
|
103 |
inp = gr.Textbox(
|
104 |
label="input",
|
@@ -109,8 +99,6 @@ with gr.Blocks() as demo:
|
|
109 |
btn = gr.Button("Process")
|
110 |
btn.click(fn=update, inputs=inp, outputs=out)
|
111 |
gr.Markdown("---")
|
112 |
-
gr.Markdown(
|
113 |
-
"- see the [model card](https://huggingface.co/pszemraj/flan-t5-large-grammar-synthesis) for more info"
|
114 |
-
)
|
115 |
gr.Markdown("- if experiencing long wait times, feel free to duplicate the space!")
|
116 |
demo.launch()
|
|
|
67 |
# Check the grammar quality of the text using the text-classification pipeline
|
68 |
results = checker(raw_text)
|
69 |
|
70 |
+
# Only correct the text if the results of the text classification are not LABEL_1 or are LABEL_1 with a score below 0.9
|
71 |
if results[0]["label"] != "LABEL_1" or (
|
72 |
results[0]["label"] == "LABEL_1" and results[0]["score"] < 0.9
|
73 |
):
|
|
|
89 |
|
90 |
|
91 |
with gr.Blocks() as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
with gr.Row():
|
93 |
inp = gr.Textbox(
|
94 |
label="input",
|
|
|
99 |
btn = gr.Button("Process")
|
100 |
btn.click(fn=update, inputs=inp, outputs=out)
|
101 |
gr.Markdown("---")
|
102 |
+
gr.Markdown("")
|
|
|
|
|
103 |
gr.Markdown("- if experiencing long wait times, feel free to duplicate the space!")
|
104 |
demo.launch()
|