Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,13 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
# Load
|
5 |
-
classifier = pipeline("text-classification", model="d4data/bias-detection-model",
|
6 |
-
|
7 |
|
8 |
def analyze_bias(text):
|
9 |
result = classifier(text)
|
10 |
return f"Bias: {result[0]['label']} (Confidence: {result[0]['score'] * 100:.2f}%)"
|
11 |
|
12 |
-
# Create a simple Gradio UI
|
13 |
iface = gr.Interface(fn=analyze_bias, inputs="text", outputs="text")
|
14 |
iface.launch()
|
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
# Load model using TensorFlow weights
|
5 |
+
classifier = pipeline("text-classification", model="d4data/bias-detection-model", framework="tf")
|
|
|
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 |
iface = gr.Interface(fn=analyze_bias, inputs="text", outputs="text")
|
12 |
iface.launch()
|
13 |
+
|