AlexOuellet commited on
Commit
535fef0
·
verified ·
1 Parent(s): 4f5cbea

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
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()