Spaces:
Runtime error
Runtime error
Updated app file
Browse files- app.py +3 -9
- requirements.txt +1 -1
app.py
CHANGED
@@ -3,7 +3,7 @@ import pandas as pd
|
|
3 |
import numpy as np
|
4 |
# from scipy.special import softmax
|
5 |
# import os
|
6 |
-
from utils import run_sentiment_analysis, preprocess
|
7 |
from transformers import AutoTokenizer, AutoConfig,AutoModelForSequenceClassification
|
8 |
import os
|
9 |
import time
|
@@ -96,15 +96,9 @@ with my_expander:
|
|
96 |
positive_score = st.metric(label='Score', value=round(results['Positive'], 4), label_visibility='collapsed')
|
97 |
time.sleep(5)
|
98 |
success_message.empty()
|
99 |
-
interpret_button = col2.button(label='Interpret',type='secondary', use_container_width=True)
|
100 |
-
if interpret_button:
|
101 |
-
ig = integrated_gradients(text, model)
|
102 |
-
|
103 |
-
ig = ig.sum(dim=-1).squeeze().detach().numpy()[0]
|
104 |
-
ig = (ig - ig.min()) / (ig.max() - ig.min())
|
105 |
-
# Display the Integrated Gradients as a bar chart
|
106 |
-
st.bar_chart(ig)
|
107 |
|
108 |
|
109 |
# st.help()
|
110 |
# create a date input to receive date
|
|
|
|
3 |
import numpy as np
|
4 |
# from scipy.special import softmax
|
5 |
# import os
|
6 |
+
from utils import run_sentiment_analysis, preprocess
|
7 |
from transformers import AutoTokenizer, AutoConfig,AutoModelForSequenceClassification
|
8 |
import os
|
9 |
import time
|
|
|
96 |
positive_score = st.metric(label='Score', value=round(results['Positive'], 4), label_visibility='collapsed')
|
97 |
time.sleep(5)
|
98 |
success_message.empty()
|
99 |
+
# interpret_button = col2.button(label='Interpret',type='secondary', use_container_width=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
|
101 |
|
102 |
# st.help()
|
103 |
# create a date input to receive date
|
104 |
+
|
requirements.txt
CHANGED
@@ -5,4 +5,4 @@ datasets==2.12.0
|
|
5 |
numpy==1.22.4
|
6 |
pandas==1.5.3
|
7 |
scikit-learn==1.2.2
|
8 |
-
transformers==4.28.1
|
|
|
5 |
numpy==1.22.4
|
6 |
pandas==1.5.3
|
7 |
scikit-learn==1.2.2
|
8 |
+
transformers==4.28.1
|