AlexOuellet commited on
Commit
dcc7bde
·
verified ·
1 Parent(s): 721ae28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -1,14 +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="d4data/bias-detection-model", from_tf=True)
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
+