Spaces:
Sleeping
Sleeping
update UI
Browse files- .ipynb_checkpoints/app-checkpoint.py +9 -6
- app.py +9 -6
.ipynb_checkpoints/app-checkpoint.py
CHANGED
@@ -19,20 +19,23 @@ def infer(s1, s2):
|
|
19 |
})
|
20 |
|
21 |
if "error" in data:
|
22 |
-
return "Error
|
23 |
elif "generated_text" in data[0]:
|
24 |
-
output = data[0]["generated_text"].
|
25 |
return output
|
26 |
else:
|
27 |
-
return data
|
28 |
|
29 |
title = "Paraphrase Classification and Explanation"
|
30 |
long_desc = "This is a Flan-T5-Large model fine-tuned to perform paraphrase classification and explanation. The model takes in two sentences as inputs, and outputs a classification label and explanation. The model is trained on our Semantic Paraphrase Types dataset. Feel free to modify the example inputs or enter in your own sentences. Due to existing limitations, the explanation generated may not be entirely accurate. We hope that in future work, more powerful models can be trained and produce more accurate explanations."
|
31 |
|
32 |
-
s1 = gr.Textbox(value="On Monday, Tom went to the market.",label="Sentence 1")
|
33 |
-
s2 = gr.Textbox(value="Tom went to the market
|
34 |
|
35 |
-
|
|
|
|
|
|
|
36 |
title=title,
|
37 |
article=long_desc,
|
38 |
)
|
|
|
19 |
})
|
20 |
|
21 |
if "error" in data:
|
22 |
+
return ["Error", data["error"]]
|
23 |
elif "generated_text" in data[0]:
|
24 |
+
output = data[0]["generated_text"].split("\n")
|
25 |
return output
|
26 |
else:
|
27 |
+
return data, data
|
28 |
|
29 |
title = "Paraphrase Classification and Explanation"
|
30 |
long_desc = "This is a Flan-T5-Large model fine-tuned to perform paraphrase classification and explanation. The model takes in two sentences as inputs, and outputs a classification label and explanation. The model is trained on our Semantic Paraphrase Types dataset. Feel free to modify the example inputs or enter in your own sentences. Due to existing limitations, the explanation generated may not be entirely accurate. We hope that in future work, more powerful models can be trained and produce more accurate explanations."
|
31 |
|
32 |
+
s1 = gr.Textbox(value="On Monday, Tom went to the market and bought a pig.",label="Sentence 1")
|
33 |
+
s2 = gr.Textbox(value="Tom went to the market.",label="Sentence 2")
|
34 |
|
35 |
+
label = gr.Markdown(value="")
|
36 |
+
explain = gr.Markdown(value="")
|
37 |
+
|
38 |
+
demo = gr.Interface(fn=infer, inputs=[s1,s2], outputs=[label,explain],
|
39 |
title=title,
|
40 |
article=long_desc,
|
41 |
)
|
app.py
CHANGED
@@ -19,20 +19,23 @@ def infer(s1, s2):
|
|
19 |
})
|
20 |
|
21 |
if "error" in data:
|
22 |
-
return "Error
|
23 |
elif "generated_text" in data[0]:
|
24 |
-
output = data[0]["generated_text"].
|
25 |
return output
|
26 |
else:
|
27 |
-
return data
|
28 |
|
29 |
title = "Paraphrase Classification and Explanation"
|
30 |
long_desc = "This is a Flan-T5-Large model fine-tuned to perform paraphrase classification and explanation. The model takes in two sentences as inputs, and outputs a classification label and explanation. The model is trained on our Semantic Paraphrase Types dataset. Feel free to modify the example inputs or enter in your own sentences. Due to existing limitations, the explanation generated may not be entirely accurate. We hope that in future work, more powerful models can be trained and produce more accurate explanations."
|
31 |
|
32 |
-
s1 = gr.Textbox(value="On Monday, Tom went to the market.",label="Sentence 1")
|
33 |
-
s2 = gr.Textbox(value="Tom went to the market
|
34 |
|
35 |
-
|
|
|
|
|
|
|
36 |
title=title,
|
37 |
article=long_desc,
|
38 |
)
|
|
|
19 |
})
|
20 |
|
21 |
if "error" in data:
|
22 |
+
return ["Error", data["error"]]
|
23 |
elif "generated_text" in data[0]:
|
24 |
+
output = data[0]["generated_text"].split("\n")
|
25 |
return output
|
26 |
else:
|
27 |
+
return data, data
|
28 |
|
29 |
title = "Paraphrase Classification and Explanation"
|
30 |
long_desc = "This is a Flan-T5-Large model fine-tuned to perform paraphrase classification and explanation. The model takes in two sentences as inputs, and outputs a classification label and explanation. The model is trained on our Semantic Paraphrase Types dataset. Feel free to modify the example inputs or enter in your own sentences. Due to existing limitations, the explanation generated may not be entirely accurate. We hope that in future work, more powerful models can be trained and produce more accurate explanations."
|
31 |
|
32 |
+
s1 = gr.Textbox(value="On Monday, Tom went to the market and bought a pig.",label="Sentence 1")
|
33 |
+
s2 = gr.Textbox(value="Tom went to the market.",label="Sentence 2")
|
34 |
|
35 |
+
label = gr.Markdown(value="")
|
36 |
+
explain = gr.Markdown(value="")
|
37 |
+
|
38 |
+
demo = gr.Interface(fn=infer, inputs=[s1,s2], outputs=[label,explain],
|
39 |
title=title,
|
40 |
article=long_desc,
|
41 |
)
|