Spaces:
Runtime error
Runtime error
accplan commited on
Commit Β·
5ba1e8a
1
Parent(s): ef7efd2
test
Browse files- app.py +12 -0
- requirements.txt +1 -0
app.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from happytransformer import HappyTextToText, TTSettings
|
| 3 |
+
|
| 4 |
+
happy_tt = HappyTextToText("T5", "vennify/t5-base-grammar-correction")
|
| 5 |
+
args = TTSettings(num_beams=5, min_length=1)
|
| 6 |
+
|
| 7 |
+
def fix(bad):
|
| 8 |
+
result = happy_tt.generate_text("grammar: " + bad, args=args)
|
| 9 |
+
return result
|
| 10 |
+
|
| 11 |
+
iface = gr.Interface(fn=fix, inputs="text", outputs="text")
|
| 12 |
+
iface.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
happytransformer==2.4.1
|