HyperX-Sentience commited on
Commit
4f398a9
·
verified ·
1 Parent(s): 20a6a5f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -33,11 +33,14 @@ def predict_toxicity(comment):
33
 
34
  return {labels[i]: float(probabilities[i]) for i in range(len(labels))}
35
 
 
 
36
  def format_toxicity_data(comment):
37
  """Formats the toxicity scores for a modern bar graph."""
38
  scores = predict_toxicity(comment)
39
- data = [[label, score] for label, score in scores.items()]
40
- return data
 
41
 
42
  # Gradio interface
43
  demo = gr.Interface(
 
33
 
34
  return {labels[i]: float(probabilities[i]) for i in range(len(labels))}
35
 
36
+ import pandas as pd
37
+
38
  def format_toxicity_data(comment):
39
  """Formats the toxicity scores for a modern bar graph."""
40
  scores = predict_toxicity(comment)
41
+ df = pd.DataFrame(list(scores.items()), columns=["Category", "Score"])
42
+ return df
43
+
44
 
45
  # Gradio interface
46
  demo = gr.Interface(