leavoigt commited on
Commit
a26f453
1 Parent(s): 9582274

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -32
app.py CHANGED
@@ -6,36 +6,36 @@ model = SetFitModel.from_pretrained("peter2000/vulnerable-groups-setfit")
6
 
7
  # Define the classes
8
  group_dict = {
9
- 1: 'Women and girls',
10
- 2: 'Children and youth',
11
- 3: 'Landlocked countries',
12
- 4: 'Outdoor workers',
13
- 5: 'Riverine and flood-prone areas',
14
- 6: 'Small-scale farmers',
15
- 7: 'Men and boys',
16
- 8: 'Small island developing states (SIDS)',
17
- 9: 'Fisherfolk and fishing communities',
18
- 10: 'Children with disabilities',
19
- 11: 'Low-income households',
20
- 12: 'Rural communities',
21
- 13: 'Pregnant women and new mothers',
22
- 14: 'Young adults',
23
- 15: 'Urban slums',
24
- 16: 'Gender non-conforming individuals',
25
- 17: 'Remote communities',
26
- 18: 'Older adults and the elderly',
27
- 19: 'Elderly population',
28
- 20: 'Mountain communities',
29
- 21: 'People with disabilities',
30
- 22: 'Indigenous peoples',
31
- 23: 'Informal settlements and slums',
32
- 24: 'Coastal communities',
33
- 25: 'Informal sector workers',
34
- 26: 'Drought-prone regions',
35
- 27: 'People with pre-existing health conditions',
36
- 28: 'Small-scale farmers and subsistence agriculture',
37
- 29: 'Migrants and displaced populations',
38
- 30: 'no vulnerable group mentioned'}
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
- x = st.slider('Select a value')
47
- st.write(x, 'squared is', x * x)
 
 
 
 
 
 
 
 
 
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, ")