|
import json |
|
from datetime import datetime |
|
from io import BytesIO |
|
from time import time |
|
|
|
import streamlit as st |
|
from huggingface_hub import upload_file |
|
|
|
title = "Key Takeaways" |
|
description = "Review of the information from previous pages." |
|
date = "2022-01-26" |
|
thumbnail = "images/raised_hand.png" |
|
|
|
__KEY_TAKEAWAYS = """ |
|
# Key Takeaways and Review |
|
|
|
Here are some of the main ideas we have conveyed in this exploration: |
|
- Defining hate speech is hard and changes depending on your context and goals. |
|
- Capturing a snapshot of what you've defined to be hate speech in a dataset is hard. |
|
- Models learn lots of different things based on the data it sees, and that can include things you didn't intend for them to learn. |
|
|
|
Next, please answer the following questions about the information presented in this demo: |
|
""" |
|
|
|
_HF_TOKEN = st.secrets["WRITE_TOKEN"] |
|
|
|
|
|
def run_article(): |
|
st.markdown(__KEY_TAKEAWAYS) |
|
res = {} |
|
res["used_links"] = st.text_area( |
|
"Did you click on any of the links provided in the **Hate Speech in ACM** page? If so, which one did you find most surprising?" |
|
) |
|
res["dataset_feedback"] = st.text_area( |
|
"Of the datasets presented in the **Dataset Exploration** page, which one did you think best represented content that should be moderated? Which worst?" |
|
) |
|
res["model_feedback"] = st.text_area( |
|
"Of the models presented in the **Model Exploration** page, which one did you think performed best? Which worst?" |
|
) |
|
res["additional_material"] = st.text_area( |
|
"Any additional comments about the materials?" |
|
) |
|
|
|
res["role"] = st.text_area( |
|
"How would you describe your role? E.g. model developer, dataset developer, domain expert, policy maker, platform manager, community advocate, platform user, student" |
|
) |
|
res["interest"] = st.text_area("Why are you interested in content moderation?") |
|
res["modules_used"] = st.multiselect( |
|
"Which modules did you use the most?", |
|
options=[ |
|
"Welcome - Introduction", |
|
"Hate Speech in ACM", |
|
"Dataset Exploration", |
|
"Model Exploration", |
|
], |
|
) |
|
res["modules_informative"] = st.selectbox( |
|
"Which module did you find the most informative?", |
|
options=[ |
|
"Welcome - Introduction", |
|
"Hate Speech in ACM", |
|
"Dataset Exploration", |
|
"Model Exploration", |
|
], |
|
) |
|
res["application)interest"] = st.text_area( |
|
"Which application were you most interested in learning more about?" |
|
) |
|
res["dataset_surprise"] = st.text_area( |
|
"What surprised you most about the datasets?" |
|
) |
|
res["model_concern"] = st.text_area( |
|
"Which models are you most concerned about as a user?" |
|
) |
|
res["comments_suggestions"] = st.text_area( |
|
"Do you have any comments or suggestions?" |
|
) |
|
if st.button("Submit my answers"): |
|
fname = datetime.now().strftime("submitted_%d_%m_%y_%H_%M_%S.json") |
|
submitted_to = upload_file( |
|
path_or_fileobj=BytesIO(bytearray(json.dumps(res, indent=2), "utf8")), |
|
path_in_repo=fname, |
|
repo_id="hf-task-exploration/acm_exploration_poll_answers", |
|
repo_type="dataset", |
|
token=_HF_TOKEN, |
|
) |
|
if submitted_to.startswith("https"): |
|
st.markdown("Submitted the following answers: \n---\n\n") |
|
st.write(res) |
|
|