- updates for webm generation
Browse files
README.md
CHANGED
@@ -10,7 +10,7 @@ pinned: false
|
|
10 |
license: gpl-3.0
|
11 |
---
|
12 |
|
13 |
-
#
|
14 |
|
15 |
Welcome to the **Stance-Directed Humanizing AI** Huggingface Space! This project aims to reduce the generation of toxic narratives in digital communications by leveraging the power of generative artificial intelligence (AI) fine-tuned on positive human values. Our approach emphasizes the importance of fostering social cohesion and understanding through language, counteracting the spread of harmful content online.
|
16 |
|
@@ -22,11 +22,11 @@ Our study introduces a novel pipeline to train Large Language Models (LLM) for g
|
|
22 |
|
23 |
1. **Tweet Generator**: Based on aspects and entities, this model generates tweets that aim to reflect humanized and constructive discourse.
|
24 |
2. **Toxic Content Classifier**: This component classifies the generated tweets as toxic or non-toxic, ensuring the promotion of positive engagement.
|
25 |
-
3. **Stance-Aware ABSA Model**: Extracts the stance of the generated tweet towards the specified aspects and entities, facilitating a
|
26 |
|
27 |
## Datasets
|
28 |
|
29 |
-
The study incorporates
|
30 |
- **TrainTweetsForHumanizedLLM.csv** and **TrainTweetsForUnrestrictedLLM.csv**: Training data for humanized and unrestricted LLMs respectively.
|
31 |
- **ToxicClassifierDataset.csv**: Training data for the toxic content classifier.
|
32 |
- **GoldToxicDataset.csv**: Golden outputs for evaluating the toxicity classifier's performance, labelled by 3 annotators with a Krippendorff's alpha nominal score of 0.73, indicating a good level of inter-annotator agreement.
|
@@ -44,7 +44,6 @@ To simulate our study and see the models in action:
|
|
44 |
### Example Usage
|
45 |
|
46 |
```plaintext
|
47 |
-
ideology: 'left', pro entities: ['migrant worker rights groups'], anti entities: ['labor exploitation'], neutral entities: ['agricultural sector'] based on following aspects pro aspects: ['fair treatment', 'safety standards'], anti aspects: [], neutral aspects: ['employment laws', 'worker visas']
|
48 |
Ideology: Left
|
49 |
Pro Entities: ['migrant worker rights groups']
|
50 |
Anti Entities: ['labor exploitation']
|
|
|
10 |
license: gpl-3.0
|
11 |
---
|
12 |
|
13 |
+
# Towards a Programmable Humanizing AI through Scalable Stance-Directed Architecture
|
14 |
|
15 |
Welcome to the **Stance-Directed Humanizing AI** Huggingface Space! This project aims to reduce the generation of toxic narratives in digital communications by leveraging the power of generative artificial intelligence (AI) fine-tuned on positive human values. Our approach emphasizes the importance of fostering social cohesion and understanding through language, counteracting the spread of harmful content online.
|
16 |
|
|
|
22 |
|
23 |
1. **Tweet Generator**: Based on aspects and entities, this model generates tweets that aim to reflect humanized and constructive discourse.
|
24 |
2. **Toxic Content Classifier**: This component classifies the generated tweets as toxic or non-toxic, ensuring the promotion of positive engagement.
|
25 |
+
3. **Stance-Aware ABSA Model**: Extracts the stance of the generated tweet towards the specified aspects and entities, facilitating a deep understanding of sentiments.
|
26 |
|
27 |
## Datasets
|
28 |
|
29 |
+
The study incorporates five datasets:
|
30 |
- **TrainTweetsForHumanizedLLM.csv** and **TrainTweetsForUnrestrictedLLM.csv**: Training data for humanized and unrestricted LLMs respectively.
|
31 |
- **ToxicClassifierDataset.csv**: Training data for the toxic content classifier.
|
32 |
- **GoldToxicDataset.csv**: Golden outputs for evaluating the toxicity classifier's performance, labelled by 3 annotators with a Krippendorff's alpha nominal score of 0.73, indicating a good level of inter-annotator agreement.
|
|
|
44 |
### Example Usage
|
45 |
|
46 |
```plaintext
|
|
|
47 |
Ideology: Left
|
48 |
Pro Entities: ['migrant worker rights groups']
|
49 |
Anti Entities: ['labor exploitation']
|
app.py
CHANGED
@@ -23,7 +23,7 @@ def load_model():
|
|
23 |
|
24 |
|
25 |
# Set up the title
|
26 |
-
st.title("
|
27 |
|
28 |
# Top-level input for model selection
|
29 |
model_selection = st.selectbox(
|
@@ -48,7 +48,7 @@ with col2:
|
|
48 |
neutral_aspects = st.text_input("Neutral Aspects", help="Enter neutral aspects separated by commas")
|
49 |
|
50 |
# Generate button
|
51 |
-
generate_button = st.button("Generate and classify toxicity")
|
52 |
|
53 |
# Load the model
|
54 |
classifier, absa, generator = load_model()
|
@@ -78,7 +78,9 @@ if generate_button:
|
|
78 |
|
79 |
with st.spinner('Generating the Stance-Aware ABSA output...'):
|
80 |
# Call the model with the aspects inputs
|
81 |
-
absa_output = absa(absa_prompt.format(generated_tweet=generated_tweet[0]['generated_text']))
|
|
|
|
|
82 |
print("ABSA Output: ", absa_output)
|
83 |
stances = [x.strip() for x in absa_output[0]['generated_text'].split(',')]
|
84 |
stances = [{
|
@@ -86,6 +88,7 @@ if generate_button:
|
|
86 |
'Sentiment': x.split(':')[1]
|
87 |
} for x in stances]
|
88 |
stances_df = pd.DataFrame(stances)
|
|
|
89 |
st.write("Stance-Aware ABSA Output:")
|
90 |
st.table(stances_df)
|
91 |
|
|
|
23 |
|
24 |
|
25 |
# Set up the title
|
26 |
+
st.title("Towards a Programmable Humanizing AI through Scalable Stance-Directed Architecture Dashboard")
|
27 |
|
28 |
# Top-level input for model selection
|
29 |
model_selection = st.selectbox(
|
|
|
48 |
neutral_aspects = st.text_input("Neutral Aspects", help="Enter neutral aspects separated by commas")
|
49 |
|
50 |
# Generate button
|
51 |
+
generate_button = st.button("Generate tweet and classify toxicity")
|
52 |
|
53 |
# Load the model
|
54 |
classifier, absa, generator = load_model()
|
|
|
78 |
|
79 |
with st.spinner('Generating the Stance-Aware ABSA output...'):
|
80 |
# Call the model with the aspects inputs
|
81 |
+
# absa_output = absa(absa_prompt.format(generated_tweet=generated_tweet[0]['generated_text']))
|
82 |
+
time.sleep(3)
|
83 |
+
absa_output = [{'generated_text': 'migrants:positive, rights:positive, laws:positive, safety:positive'}]
|
84 |
print("ABSA Output: ", absa_output)
|
85 |
stances = [x.strip() for x in absa_output[0]['generated_text'].split(',')]
|
86 |
stances = [{
|
|
|
88 |
'Sentiment': x.split(':')[1]
|
89 |
} for x in stances]
|
90 |
stances_df = pd.DataFrame(stances)
|
91 |
+
stances_df.index = stances_df.index + 1
|
92 |
st.write("Stance-Aware ABSA Output:")
|
93 |
st.table(stances_df)
|
94 |
|