accplan commited on
Commit
5ba1e8a
β€’
1 Parent(s): ef7efd2
Files changed (2) hide show
  1. app.py +12 -0
  2. 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