Spaces:
Sleeping
Sleeping
paragon-analytics
commited on
Commit
·
4260f66
1
Parent(s):
ade4cec
Update app.py
Browse files
app.py
CHANGED
@@ -62,12 +62,6 @@ def process_final_text(text):
|
|
62 |
scores = output[0][0].detach().numpy()
|
63 |
scores = tf.nn.softmax(scores)
|
64 |
|
65 |
-
# Transformer Interpret:
|
66 |
-
word_attributions = cls_explainer(X_test)
|
67 |
-
intp = pd.DataFrame(word_attributions)
|
68 |
-
intp.columns = ["Token",'Score']
|
69 |
-
intp_dict = intp.set_index('Token').T.to_dict('list')
|
70 |
-
|
71 |
# Get Keywords:
|
72 |
keywords = custom_kw_extractor.extract_keywords(X_test)
|
73 |
letter = []
|
@@ -96,12 +90,19 @@ def process_final_text(text):
|
|
96 |
+ sp_html
|
97 |
+ ""
|
98 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
return {"Resilience": float(scores.numpy()[1]), "Non-Resilience": float(scores.numpy()[0])},keywords,NER,intp_dict
|
100 |
|
101 |
def main(prob1):
|
102 |
text = str(prob1)
|
103 |
obj = process_final_text(text)
|
104 |
-
return obj[0],obj[1],obj[2]
|
105 |
|
106 |
title = "Welcome to **ResText** 🪐"
|
107 |
description1 = """
|
|
|
62 |
scores = output[0][0].detach().numpy()
|
63 |
scores = tf.nn.softmax(scores)
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
# Get Keywords:
|
66 |
keywords = custom_kw_extractor.extract_keywords(X_test)
|
67 |
letter = []
|
|
|
90 |
+ sp_html
|
91 |
+ ""
|
92 |
)
|
93 |
+
|
94 |
+
# Transformer Interpret:
|
95 |
+
word_attributions = cls_explainer(X_test)
|
96 |
+
intp = pd.DataFrame(word_attributions)
|
97 |
+
intp.columns = ["Token",'Score']
|
98 |
+
intp_dict = intp.set_index('Token').T.to_dict('list')
|
99 |
+
|
100 |
return {"Resilience": float(scores.numpy()[1]), "Non-Resilience": float(scores.numpy()[0])},keywords,NER,intp_dict
|
101 |
|
102 |
def main(prob1):
|
103 |
text = str(prob1)
|
104 |
obj = process_final_text(text)
|
105 |
+
return obj[0],obj[1],obj[2],obj[3]
|
106 |
|
107 |
title = "Welcome to **ResText** 🪐"
|
108 |
description1 = """
|