File size: 1,465 Bytes
beb6bae
314b49d
 
 
beb6bae
314b49d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import streamlit as st
from src.caller import OpenAI_Caller
from src.committee import Committee
from datasets import load_dataset


st.title("Committee")


committee_dict = {
    "chair": {
        "model_caller": OpenAI_Caller('gpt-4-1106-preview')
    },
    "member": [
        {
            "bias_type": "age",
            "model_caller": OpenAI_Caller('gpt-4-1106-preview')
        },
        {
            "bias_type": "gender",
            "model_caller": OpenAI_Caller('gpt-4-1106-preview')
        },
        {
            "bias_type": "religion",
            "model_caller": OpenAI_Caller('gpt-4-1106-preview')
        },
    ]
}

committee = Committee(committee_dict=committee_dict)

dataset = load_dataset("Elfsong/BBQ")
raw_instance = dataset['age'][0]

instance = {
    "context": raw_instance['context'],
    "question": raw_instance['question'],
    "ans0": raw_instance['ans0'],
    "ans1": raw_instance['ans1'],
    "ans2": raw_instance['ans2'],
}

instance = st.data_editor(instance)

print(instance)

# Propose
st.header("Propose")
proposals = list()
for member in committee.members:
    st.text("member is proposing...")
    proposal = member.propose(instance)
    st.markdown(proposal)
    proposals += [proposal]

# Craft Motion
st.header("Motion")
motion = committee.chair.craft_motion(proposals, instance)
st.markdown(motion)

# Vote
st.header("Vote")
vote = [member.vote(motion, instance) for member in committee.members]
st.markdown(vote)