Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,46 @@
|
|
1 |
import streamlit as st
|
2 |
-
from
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
-
pipe = pipeline('sentiment-analysis')
|
5 |
text = st.text_area('enter your text here')
|
6 |
|
7 |
x = st.slider('Select a value')
|
|
|
1 |
import streamlit as st
|
2 |
+
from setfit import SetFitModel
|
3 |
+
|
4 |
+
# Load the model
|
5 |
+
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()
|
42 |
+
return group_dict[preds]
|
43 |
|
|
|
44 |
text = st.text_area('enter your text here')
|
45 |
|
46 |
x = st.slider('Select a value')
|