Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,6 @@ tokenizer = RobertaTokenizer.from_pretrained(model_dir)
|
|
| 9 |
model = RobertaModel.from_pretrained(model_dir)
|
| 10 |
|
| 11 |
|
| 12 |
-
|
| 13 |
def process_text(input_text, input_file):
|
| 14 |
if input_text:
|
| 15 |
text = input_text
|
|
@@ -56,15 +55,11 @@ def process_text(input_text, input_file):
|
|
| 56 |
|
| 57 |
return processed_result, prob, final_label, text_plot,similar_articles
|
| 58 |
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
title = "Group 2- ChatGPT text detection module"
|
| 63 |
description = '''Please upload text files and text input responsibly and await the explainable results. The approach in place includes finetuning a Roberta model for text classification.Once the classifications are done the decision is exaplined thorugh the SHAP text plot.
|
| 64 |
The probability is particularly explained by the attention plots through SHAP'''
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
return ''
|
| 68 |
|
| 69 |
-
if __name__ == '__main__':
|
| 70 |
-
app.run(debug=True)
|
|
|
|
| 9 |
model = RobertaModel.from_pretrained(model_dir)
|
| 10 |
|
| 11 |
|
|
|
|
| 12 |
def process_text(input_text, input_file):
|
| 13 |
if input_text:
|
| 14 |
text = input_text
|
|
|
|
| 55 |
|
| 56 |
return processed_result, prob, final_label, text_plot,similar_articles
|
| 57 |
|
| 58 |
+
text_input = gr.inputs.Textbox(label="Enter text")
|
| 59 |
+
file_input = gr.inputs.File(label="Upload a text file")
|
| 60 |
+
outputs = [gr.Textbox(label="Processed text"), gr.Textbox(label="Probability"), gr.Textbox(label="Label"), gr.HTML(label="SHAP Plot"),gr.Table(label="Similar Articles", columns=["Title", "Link"])]
|
| 61 |
title = "Group 2- ChatGPT text detection module"
|
| 62 |
description = '''Please upload text files and text input responsibly and await the explainable results. The approach in place includes finetuning a Roberta model for text classification.Once the classifications are done the decision is exaplined thorugh the SHAP text plot.
|
| 63 |
The probability is particularly explained by the attention plots through SHAP'''
|
| 64 |
+
gr.Interface(fn=process_text,title=title,descriptioon=description, inputs=[text_input, file_input], outputs=outputs).launch()
|
|
|
|
|
|
|
| 65 |
|
|
|
|
|
|