hf-dongpyo commited on
Commit
012dca9
1 Parent(s): 70b4cc0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -1
app.py CHANGED
@@ -58,6 +58,14 @@ def text2text_sentiment(text):
58
 
59
  return response
60
 
 
 
 
 
 
 
 
 
61
  # question
62
  # context = grad.Textbox(lines = 10, label = 'English', placeholder = 'Context')
63
  # ans = grad.Textbox(lines = 1, label = 'Answer')
@@ -75,12 +83,17 @@ def text2text_sentiment(text):
75
  para = grad.Textbox(lines = 1, label = 'English Text', placeholder = 'Text in English')
76
  out = grad.Textbox(lines = 1, label = 'Sentiment')
77
 
 
 
 
 
78
  grad.Interface(
79
  # text2text,
80
  # inputs = [context, ans],
81
  # text2text_summary,
82
  # text2text_translate,
83
- text2text_sentiment,
 
84
  inputs = para,
85
  outputs = out
86
  ).launch()
 
58
 
59
  return response
60
 
61
+ def text2text_acceptable_sentence(text):
62
+ inp = "cola sentence: " + text
63
+ enc = text2text_tkn(inp, return_tensors = 'pt')
64
+ tokens = mdl.generate(**enc)
65
+ response = text2text_tkn.batch_decode(tokens)
66
+
67
+ return response
68
+
69
  # question
70
  # context = grad.Textbox(lines = 10, label = 'English', placeholder = 'Context')
71
  # ans = grad.Textbox(lines = 1, label = 'Answer')
 
83
  para = grad.Textbox(lines = 1, label = 'English Text', placeholder = 'Text in English')
84
  out = grad.Textbox(lines = 1, label = 'Sentiment')
85
 
86
+ # grammatical acceptance
87
+ para = grad.Textbox(lines = 1, label = 'English Text', placeholder = 'Text in English')
88
+ out = grad.Textbox(lines = 1, label = 'Whether the sentence is acceptable or not')
89
+
90
  grad.Interface(
91
  # text2text,
92
  # inputs = [context, ans],
93
  # text2text_summary,
94
  # text2text_translate,
95
+ # text2text_sentiment,
96
+ text2text_acceptable_sentence,
97
  inputs = para,
98
  outputs = out
99
  ).launch()