File size: 1,363 Bytes
eee7134
eab471f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ecc8799
 
eee7134
 
 
1
2
3
4
5
6
7
8
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
41
42
43
44
45
46
47
import streamlit as st
from setfit import SetFitModel

# Load the model
model = SetFitModel.from_pretrained("peter2000/vulnerable-groups-setfit")

# Define the classes
group_dict = {
    1: 'Women and girls',
 2: 'Children and youth',
 3: 'Landlocked countries',
 4: 'Outdoor workers',
 5: 'Riverine and flood-prone areas',
 6: 'Small-scale farmers',
 7: 'Men and boys',
 8: 'Small island developing states (SIDS)',
 9: 'Fisherfolk and fishing communities',
 10: 'Children with disabilities',
 11: 'Low-income households',
 12: 'Rural communities',
 13: 'Pregnant women and new mothers',
 14: 'Young adults',
 15: 'Urban slums',
 16: 'Gender non-conforming individuals',
 17: 'Remote communities',
 18: 'Older adults and the elderly',
 19: 'Elderly population',
 20: 'Mountain communities',
 21: 'People with disabilities',
 22: 'Indigenous peoples',
 23: 'Informal settlements and slums',
 24: 'Coastal communities',
 25: 'Informal sector workers',
 26: 'Drought-prone regions',
 27: 'People with pre-existing health conditions',
 28: 'Small-scale farmers and subsistence agriculture',
 29: 'Migrants and displaced populations',
 30: 'no vulnerable group mentioned'}

def predict(text):
    preds = model([text])[0].item()
    return group_dict[preds]

text = st.text_area('enter your text here')

x = st.slider('Select a value')
st.write(x, 'squared is', x * x)