mihalykiss commited on
Commit
94cb644
·
verified ·
1 Parent(s): c402f62

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -54,6 +54,8 @@ tokenizer.backend_tokenizer.normalizer = Sequence([
54
  newline_to_space,
55
  Strip()
56
  ])
 
 
57
  def classify_text(text):
58
  """
59
  Classifies the text and generates a plot of the human vs AI probability.
@@ -99,8 +101,7 @@ def classify_text(text):
99
  f"**Identified LLM: {ai_argmax_model}**"
100
  )
101
 
102
- # Create a plot for Human vs AI probabilities
103
- fig, ax = plt.subplots(figsize=(6, 3))
104
 
105
  categories = ['Human', 'AI']
106
  probabilities_for_plot = [human_percentage, ai_percentage]
@@ -115,7 +116,7 @@ def classify_text(text):
115
  height = bar.get_height()
116
  ax.text(bar.get_x() + bar.get_width() / 2, height + 1, f'{height:.2f}%', ha='center')
117
 
118
- ax.set_ylim(0, 100)
119
  plt.tight_layout()
120
 
121
  return result_message, fig
@@ -123,6 +124,7 @@ def classify_text(text):
123
 
124
 
125
 
 
126
  title = "AI Text Detector"
127
 
128
  description = """
 
54
  newline_to_space,
55
  Strip()
56
  ])
57
+
58
+
59
  def classify_text(text):
60
  """
61
  Classifies the text and generates a plot of the human vs AI probability.
 
101
  f"**Identified LLM: {ai_argmax_model}**"
102
  )
103
 
104
+ fig, ax = plt.subplots(figsize=(8, 4)) # Adjust figure size for better layout
 
105
 
106
  categories = ['Human', 'AI']
107
  probabilities_for_plot = [human_percentage, ai_percentage]
 
116
  height = bar.get_height()
117
  ax.text(bar.get_x() + bar.get_width() / 2, height + 1, f'{height:.2f}%', ha='center')
118
 
119
+ ax.set_ylim(0, 100)
120
  plt.tight_layout()
121
 
122
  return result_message, fig
 
124
 
125
 
126
 
127
+
128
  title = "AI Text Detector"
129
 
130
  description = """