Update app.py
Browse files
app.py
CHANGED
@@ -6,36 +6,36 @@ model = SetFitModel.from_pretrained("peter2000/vulnerable-groups-setfit")
|
|
6 |
|
7 |
# Define the classes
|
8 |
group_dict = {
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
|
40 |
def predict(text):
|
41 |
preds = model([text])[0].item()
|
@@ -43,5 +43,13 @@ def predict(text):
|
|
43 |
|
44 |
text = st.text_area('enter your text here')
|
45 |
|
46 |
-
|
47 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
# Define the classes
|
8 |
group_dict = {
|
9 |
+
0: 'Coastal communities',
|
10 |
+
1: 'Small island developing states (SIDS)',
|
11 |
+
2: 'Landlocked countries',
|
12 |
+
3: 'Low-income households',
|
13 |
+
4: 'Informal settlements and slums',
|
14 |
+
5: 'Rural communities',
|
15 |
+
6: 'Children and youth',
|
16 |
+
7: 'Older adults and the elderly',
|
17 |
+
8: 'Women and girls',
|
18 |
+
9: 'People with pre-existing health conditions',
|
19 |
+
10: 'People with disabilities',
|
20 |
+
11: 'Small-scale farmers and subsistence agriculture',
|
21 |
+
12: 'Fisherfolk and fishing communities',
|
22 |
+
13: 'Informal sector workers',
|
23 |
+
14: 'Children with disabilities',
|
24 |
+
15: 'Remote communities',
|
25 |
+
16: 'Young adults',
|
26 |
+
17: 'Elderly population',
|
27 |
+
18: 'Urban slums',
|
28 |
+
19: 'Men and boys',
|
29 |
+
20: 'Gender non-conforming individuals',
|
30 |
+
21: 'Pregnant women and new mothers',
|
31 |
+
22: 'Mountain communities',
|
32 |
+
23: 'Riverine and flood-prone areas',
|
33 |
+
24: 'Drought-prone regions',
|
34 |
+
25: 'Indigenous peoples',
|
35 |
+
26: 'Migrants and displaced populations',
|
36 |
+
27: 'Outdoor workers',
|
37 |
+
28: 'Small-scale farmers',
|
38 |
+
29: 'Other'}
|
39 |
|
40 |
def predict(text):
|
41 |
preds = model([text])[0].item()
|
|
|
43 |
|
44 |
text = st.text_area('enter your text here')
|
45 |
|
46 |
+
# App
|
47 |
+
st.title("Identify references to vulnerable groups.")
|
48 |
+
st.write("This app allows you to identify whether a text contains any references to vulnerable groups. This can, for example, be used to analyse policy documents.")
|
49 |
+
|
50 |
+
col1, col2 = st.columns(2)
|
51 |
+
|
52 |
+
col1.text_area('enter your text here')
|
53 |
+
col2.text('f"{ group_dict['label'] }: { round(p['score'] * 100, 1)}%"')
|
54 |
+
|
55 |
+
st.write("Example: To promote gender diversity, ")
|