Spaces:
Runtime error
Runtime error
Edward J. Schwartz
commited on
Commit
•
3466141
1
Parent(s):
eed6546
progress bar
Browse files- .vscode/settings.json +3 -0
- app.py +4 -2
.vscode/settings.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"python.analysis.typeCheckingMode": "off"
|
3 |
+
}
|
app.py
CHANGED
@@ -49,7 +49,8 @@ def get_all_dis(bname, addrs=None):
|
|
49 |
|
50 |
return func_dis
|
51 |
|
52 |
-
def get_funs(f):
|
|
|
53 |
funs = get_all_dis(f.name)
|
54 |
return "\n".join(("%#x" % addr) for addr in funs.keys())
|
55 |
|
@@ -132,9 +133,10 @@ with gr.Blocks() as demo:
|
|
132 |
# transformers pipeline, and I don't feel like figuring out how to
|
133 |
# reimplement that, so we'll just use a regular transformers pipeline here
|
134 |
# for interpretation.
|
135 |
-
def interpretation_function(text):
|
136 |
|
137 |
explainer = shap.Explainer(model_interp)
|
|
|
138 |
shap_values = explainer([text])
|
139 |
|
140 |
# Dimensions are (batch size, text size, number of classes)
|
|
|
49 |
|
50 |
return func_dis
|
51 |
|
52 |
+
def get_funs(f, progress=gr.Progress()):
|
53 |
+
progress(0, "Identifying functions")
|
54 |
funs = get_all_dis(f.name)
|
55 |
return "\n".join(("%#x" % addr) for addr in funs.keys())
|
56 |
|
|
|
133 |
# transformers pipeline, and I don't feel like figuring out how to
|
134 |
# reimplement that, so we'll just use a regular transformers pipeline here
|
135 |
# for interpretation.
|
136 |
+
def interpretation_function(text, progress=gr.Progress()):
|
137 |
|
138 |
explainer = shap.Explainer(model_interp)
|
139 |
+
progress(0, "Generating explanations; this takes a long time")
|
140 |
shap_values = explainer([text])
|
141 |
|
142 |
# Dimensions are (batch size, text size, number of classes)
|