Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -37,9 +37,10 @@ group_dict = {
|
|
37 |
28: 'Small-scale farmers',
|
38 |
29: 'Other'}
|
39 |
|
40 |
-
def predict(text):
|
41 |
-
|
42 |
-
|
|
|
43 |
|
44 |
# App
|
45 |
st.title("Identify references to vulnerable groups.")
|
@@ -47,6 +48,16 @@ st.write("This app allows you to identify whether a text contains any references
|
|
47 |
|
48 |
#col1, col2 = st.columns(2)
|
49 |
|
|
|
50 |
input_text = st.text_area('Please enter your text here')
|
51 |
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
28: 'Small-scale farmers',
|
38 |
29: 'Other'}
|
39 |
|
40 |
+
#def predict(text):
|
41 |
+
# preds = model([text])[0].item()
|
42 |
+
# return group_dict[preds]
|
43 |
+
|
44 |
|
45 |
# App
|
46 |
st.title("Identify references to vulnerable groups.")
|
|
|
48 |
|
49 |
#col1, col2 = st.columns(2)
|
50 |
|
51 |
+
# Create text input box
|
52 |
input_text = st.text_area('Please enter your text here')
|
53 |
|
54 |
+
# Make predictions
|
55 |
+
preds = model(input_text)
|
56 |
+
|
57 |
+
# Select lab
|
58 |
+
def get_label(prediction_tensor):
|
59 |
+
key = prediction_tensor.index(1)
|
60 |
+
return group_dict[key]
|
61 |
+
|
62 |
+
|
63 |
+
st.text(get_label(preds))
|