Spaces:
Runtime error
Runtime error
Commit
·
579be1d
1
Parent(s):
cba913c
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,7 +46,7 @@ def interpretation_function(text):
|
|
| 46 |
# return val
|
| 47 |
|
| 48 |
def adr_predict(x):
|
| 49 |
-
encoded_input = tokenizer(
|
| 50 |
output = model(**encoded_input)
|
| 51 |
scores = output[0][0].detach().numpy()
|
| 52 |
scores = tf.nn.softmax(scores)
|
|
@@ -96,12 +96,9 @@ def main(prob1):
|
|
| 96 |
text = str(prob1).lower()
|
| 97 |
obj = adr_predict(text)
|
| 98 |
return obj[0],obj[1]
|
| 99 |
-
# ,obj[2]
|
| 100 |
|
| 101 |
title = "Welcome to **ADR Detector** 🪐"
|
| 102 |
-
description1 = """
|
| 103 |
-
This app takes text (up to a few sentences) and predicts to what extent the text describes severe (or non-severe) adverse reaction to medicaitons.
|
| 104 |
-
"""
|
| 105 |
|
| 106 |
with gr.Blocks(title=title) as demo:
|
| 107 |
gr.Markdown(f"## {title}")
|
|
@@ -135,9 +132,7 @@ with gr.Blocks(title=title) as demo:
|
|
| 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)
|
| 142 |
|
| 143 |
demo.launch()
|
|
|
|
| 46 |
# return val
|
| 47 |
|
| 48 |
def adr_predict(x):
|
| 49 |
+
encoded_input = tokenizer(x, return_tensors='pt')
|
| 50 |
output = model(**encoded_input)
|
| 51 |
scores = output[0][0].detach().numpy()
|
| 52 |
scores = tf.nn.softmax(scores)
|
|
|
|
| 96 |
text = str(prob1).lower()
|
| 97 |
obj = adr_predict(text)
|
| 98 |
return obj[0],obj[1]
|
|
|
|
| 99 |
|
| 100 |
title = "Welcome to **ADR Detector** 🪐"
|
| 101 |
+
description1 = """This app takes text (up to a few sentences) and predicts to what extent the text describes severe (or non-severe) adverse reaction to medicaitons."""
|
|
|
|
|
|
|
| 102 |
|
| 103 |
with gr.Blocks(title=title) as demo:
|
| 104 |
gr.Markdown(f"## {title}")
|
|
|
|
| 132 |
)
|
| 133 |
|
| 134 |
gr.Markdown("### Click on any of the examples below to see to what extent they contain resilience messaging:")
|
| 135 |
+
gr.Examples([["I have minor pain."],["I have severe pain."]], [prob1], [label,interpretation
|
|
|
|
|
|
|
| 136 |
], main, cache_examples=True)
|
| 137 |
|
| 138 |
demo.launch()
|