|
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) |
|
|
|
|
|
st.header("Propose") |
|
proposals = list() |
|
for member in committee.members: |
|
st.text("member is proposing...") |
|
proposal = member.propose(instance) |
|
st.markdown(proposal) |
|
proposals += [proposal] |
|
|
|
|
|
st.header("Motion") |
|
motion = committee.chair.craft_motion(proposals, instance) |
|
st.markdown(motion) |
|
|
|
|
|
st.header("Vote") |
|
vote = [member.vote(motion, instance) for member in committee.members] |
|
st.markdown(vote) |