Spaces:
Runtime error
Runtime error
Commit
·
2156cce
1
Parent(s):
d2827b6
Update app.py
Browse files
app.py
CHANGED
|
@@ -76,6 +76,16 @@ def text2text_paraphrase(sentence1, sentence2):
|
|
| 76 |
|
| 77 |
return response
|
| 78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
# question
|
| 80 |
# context = grad.Textbox(lines = 10, label = 'English', placeholder = 'Context')
|
| 81 |
# ans = grad.Textbox(lines = 1, label = 'Answer')
|
|
@@ -97,10 +107,15 @@ def text2text_paraphrase(sentence1, sentence2):
|
|
| 97 |
# para = grad.Textbox(lines = 1, label = 'English Text', placeholder = 'Text in English')
|
| 98 |
# out = grad.Textbox(lines = 1, label = 'Whether the sentence is acceptable or not')
|
| 99 |
|
| 100 |
-
# paraphrase
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
sent1 = grad.Textbox(lines = 1, label = 'Sentence1', placeholder = 'Text in English')
|
| 102 |
sent2 = grad.Textbox(lines = 1, label = 'Sentence2', placeholder = 'Text in English')
|
| 103 |
-
out = grad.Textbox(lines = 1, label = '
|
| 104 |
|
| 105 |
grad.Interface(
|
| 106 |
# text2text,
|
|
@@ -109,7 +124,8 @@ grad.Interface(
|
|
| 109 |
# text2text_translate,
|
| 110 |
# text2text_sentiment,
|
| 111 |
# text2text_acceptable_sentence,
|
| 112 |
-
text2text_paraphrase,
|
|
|
|
| 113 |
# inputs = para,
|
| 114 |
inputs = [sent1, sent2],
|
| 115 |
outputs = out
|
|
|
|
| 76 |
|
| 77 |
return response
|
| 78 |
|
| 79 |
+
def text2text_deductible(sentence1, sentence2):
|
| 80 |
+
inp1 = "rte sentence1: " + sentence1
|
| 81 |
+
inp2 = "sentence2: " + sentence2
|
| 82 |
+
combined_inpu = inp1 + " " + inp2
|
| 83 |
+
enc = text2text_tkn(combined_inp, return_tensors = 'pt')
|
| 84 |
+
tokens = mdl.generate(**enc)
|
| 85 |
+
response = text2text_tkn.batch_decode(tokens)
|
| 86 |
+
|
| 87 |
+
return response
|
| 88 |
+
|
| 89 |
# question
|
| 90 |
# context = grad.Textbox(lines = 10, label = 'English', placeholder = 'Context')
|
| 91 |
# ans = grad.Textbox(lines = 1, label = 'Answer')
|
|
|
|
| 107 |
# para = grad.Textbox(lines = 1, label = 'English Text', placeholder = 'Text in English')
|
| 108 |
# out = grad.Textbox(lines = 1, label = 'Whether the sentence is acceptable or not')
|
| 109 |
|
| 110 |
+
# # paraphrase
|
| 111 |
+
# sent1 = grad.Textbox(lines = 1, label = 'Sentence1', placeholder = 'Text in English')
|
| 112 |
+
# sent2 = grad.Textbox(lines = 1, label = 'Sentence2', placeholder = 'Text in English')
|
| 113 |
+
# out = grad.Textbox(lines = 1, label = 'Paraphrase')
|
| 114 |
+
|
| 115 |
+
# deduction
|
| 116 |
sent1 = grad.Textbox(lines = 1, label = 'Sentence1', placeholder = 'Text in English')
|
| 117 |
sent2 = grad.Textbox(lines = 1, label = 'Sentence2', placeholder = 'Text in English')
|
| 118 |
+
out = grad.Textbox(lines = 1, label = 'Deduction')
|
| 119 |
|
| 120 |
grad.Interface(
|
| 121 |
# text2text,
|
|
|
|
| 124 |
# text2text_translate,
|
| 125 |
# text2text_sentiment,
|
| 126 |
# text2text_acceptable_sentence,
|
| 127 |
+
# text2text_paraphrase,
|
| 128 |
+
text2text_duductible,
|
| 129 |
# inputs = para,
|
| 130 |
inputs = [sent1, sent2],
|
| 131 |
outputs = out
|