paragon-analytics
commited on
Commit
•
42c5082
1
Parent(s):
2888c51
Update app.py
Browse files
app.py
CHANGED
@@ -92,7 +92,8 @@ def adr_predict(x):
|
|
92 |
return {"Severe Reaction": float(scores.numpy()[1]), "Non-severe Reaction": float(scores.numpy()[0])}, shap_scores
|
93 |
# , word_attributions ,scores
|
94 |
|
95 |
-
def main(
|
|
|
96 |
obj = adr_predict(text)
|
97 |
return obj[0],obj[1]
|
98 |
# ,obj[2]
|
@@ -106,7 +107,7 @@ with gr.Blocks(title=title) as demo:
|
|
106 |
gr.Markdown(f"## {title}")
|
107 |
gr.Markdown(description1)
|
108 |
gr.Markdown("""---""")
|
109 |
-
|
110 |
submit_btn = gr.Button("Analyze")
|
111 |
|
112 |
|
@@ -126,7 +127,7 @@ with gr.Blocks(title=title) as demo:
|
|
126 |
|
127 |
submit_btn.click(
|
128 |
main,
|
129 |
-
[
|
130 |
[label
|
131 |
# ,intp
|
132 |
,interpretation
|
@@ -134,7 +135,7 @@ with gr.Blocks(title=title) as demo:
|
|
134 |
)
|
135 |
|
136 |
gr.Markdown("### Click on any of the examples below to see to what extent they contain resilience messaging:")
|
137 |
-
gr.Examples([["I have minor pain."],["I have severe pain."]], [
|
138 |
# ,intp
|
139 |
,interpretation
|
140 |
], main, cache_examples=True)
|
|
|
92 |
return {"Severe Reaction": float(scores.numpy()[1]), "Non-severe Reaction": float(scores.numpy()[0])}, shap_scores
|
93 |
# , word_attributions ,scores
|
94 |
|
95 |
+
def main(prob1):
|
96 |
+
text = str(prob1).lower()
|
97 |
obj = adr_predict(text)
|
98 |
return obj[0],obj[1]
|
99 |
# ,obj[2]
|
|
|
107 |
gr.Markdown(f"## {title}")
|
108 |
gr.Markdown(description1)
|
109 |
gr.Markdown("""---""")
|
110 |
+
prob1 = gr.Textbox(label="Enter Your Text Here:",lines=2, placeholder="Type it here ...")
|
111 |
submit_btn = gr.Button("Analyze")
|
112 |
|
113 |
|
|
|
127 |
|
128 |
submit_btn.click(
|
129 |
main,
|
130 |
+
[prob1],
|
131 |
[label
|
132 |
# ,intp
|
133 |
,interpretation
|
|
|
135 |
)
|
136 |
|
137 |
gr.Markdown("### Click on any of the examples below to see to what extent they contain resilience messaging:")
|
138 |
+
gr.Examples([["I have minor pain."],["I have severe pain."]], [prob1], [label
|
139 |
# ,intp
|
140 |
,interpretation
|
141 |
], main, cache_examples=True)
|