Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Load the bias detection model (this can be changed to other models)
|
5 |
+
classifier = pipeline("text-classification", model="cardiffnlp/twitter-roberta-base-bias")
|
6 |
+
|
7 |
+
def analyze_bias(text):
|
8 |
+
result = classifier(text)
|
9 |
+
return f"Bias: {result[0]['label']} (Confidence: {result[0]['score'] * 100:.2f}%)"
|
10 |
+
|
11 |
+
# Create a simple Gradio UI
|
12 |
+
iface = gr.Interface(fn=analyze_bias, inputs="text", outputs="text")
|
13 |
+
iface.launch()
|