leavoigt commited on
Commit
3e2e22a
1 Parent(s): 5172fa7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -37,6 +37,10 @@ group_dict = {
37
  28: 'Small-scale farmers',
38
  29: 'Other'}
39
 
 
 
 
 
40
  # App
41
  st.title("Identify references to vulnerable groups.")
42
  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.")
@@ -44,11 +48,11 @@ st.write("This app allows you to identify whether a text contains any references
44
  col1, col2 = st.columns(2)
45
 
46
  with col1:
47
- input_text = st.text_area('enter your text here')
48
 
49
- preds = model(["input_text"])
50
 
51
  with col2:
52
- st.text(preds)
53
 
54
  st.write("Example: To promote gender diversity, several new policies are being implemented")
 
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
  # App
45
  st.title("Identify references to vulnerable groups.")
46
  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.")
 
48
  col1, col2 = st.columns(2)
49
 
50
  with col1:
51
+ input_text = st.text_area('Please enter your text here')
52
 
53
+ #preds = model(["input_text"])
54
 
55
  with col2:
56
+ st.text(predict(input_text))
57
 
58
  st.write("Example: To promote gender diversity, several new policies are being implemented")