mihalykiss commited on
Commit
da1ebea
Β·
1 Parent(s): 328a8f1

UI - theme

Browse files
Files changed (1) hide show
  1. app.py +46 -22
app.py CHANGED
@@ -35,10 +35,10 @@ def classify_text(text):
35
  confidence = probabilities[predicted_class].item() * 100
36
 
37
  if predicted_class == 24:
38
- prediction_label = f"βœ… - The text is **{confidence:.2f}%** likely **Human written**."
39
  model_info = ""
40
  else:
41
- prediction_label = f"πŸ€– - The text is **{confidence:.2f}%** likely **AI generated**."
42
  model_info = f"**Identified AI Model:** {label_mapping[predicted_class]}"
43
 
44
  result_message = f"**Result:**\n\n{prediction_label}"
@@ -49,17 +49,17 @@ def classify_text(text):
49
 
50
  title = "AI Text Detector"
51
  description = """
52
- **AI detection tool by SzegedAI**
53
 
54
  Detect AI-generated texts with precision using the new **ModernBERT** model, fine-tuned for machine-generated text detection, and capable of identifying 40 different models.
55
 
56
- - **πŸ€– Identify AI Models**: Reveals which LLM generated the text if detected as AI.
57
- - **βœ… Human Verification**: Marks confidently human-written text with a green checkmark.
58
 
59
  **Note:** The longer the text, the better the detection accuracy.
60
-
61
  """
62
 
 
 
63
  iface = gr.Interface(
64
  fn=classify_text,
65
  inputs=gr.Textbox(
@@ -79,10 +79,9 @@ iface = gr.Interface(
79
  border: 2px solid #4CAF50;
80
  font-size: 18px;
81
  padding: 15px;
82
- text-align: center;
83
- margin: 0 auto;
84
- display: block;
85
- width: 80%;
86
  }
87
  #result_output_box {
88
  border-radius: 10px;
@@ -90,35 +89,60 @@ iface = gr.Interface(
90
  font-size: 18px;
91
  padding: 15px;
92
  background-color: #2E2E3F;
93
- margin: 20px auto;
94
- width: 80%;
95
- text-align: center;
96
  }
97
  body {
98
  background: #1E1E2F;
99
  color: #E1E1E6;
100
  font-family: 'Aptos', sans-serif;
101
  padding: 20px;
102
- text-align: center;
103
  }
104
  .gradio-container {
105
  border: 2px solid #4CAF50;
106
  border-radius: 15px;
107
  padding: 30px;
108
  box-shadow: 0px 0px 20px rgba(0,255,0,0.6);
109
- margin-top: 40px;
110
- max-width: 600px;
111
- margin-left: auto;
112
- margin-right: auto;
113
  }
114
- h1, h2 {
115
  text-align: center;
116
- font-size: 32px;
117
  font-weight: bold;
118
- margin-bottom: 20px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  }
120
  """
121
  )
122
 
123
- if __name__ == "__main__":
124
  iface.launch(share=True)
 
 
 
 
 
35
  confidence = probabilities[predicted_class].item() * 100
36
 
37
  if predicted_class == 24:
38
+ prediction_label = f"βœ… - The text is <span class='highlight-human'>**{confidence:.2f}%** likely <b>Human written</b>.</span>"
39
  model_info = ""
40
  else:
41
+ prediction_label = f"πŸ€– - The text is <span class='highlight-ai'>**{confidence:.2f}%** likely <b>AI generated</b>.</span>"
42
  model_info = f"**Identified AI Model:** {label_mapping[predicted_class]}"
43
 
44
  result_message = f"**Result:**\n\n{prediction_label}"
 
49
 
50
  title = "AI Text Detector"
51
  description = """
 
52
 
53
  Detect AI-generated texts with precision using the new **ModernBERT** model, fine-tuned for machine-generated text detection, and capable of identifying 40 different models.
54
 
55
+ - **πŸ€– - Identify AI Models**: Reveals which LLM generated the text if detected as AI.
56
+ - **βœ… - Human Verification**: Marks human-written text with a green checkmark.
57
 
58
  **Note:** The longer the text, the better the detection accuracy.
 
59
  """
60
 
61
+ bottom_text = "**AI detection tool by SzegedAI**"
62
+
63
  iface = gr.Interface(
64
  fn=classify_text,
65
  inputs=gr.Textbox(
 
79
  border: 2px solid #4CAF50;
80
  font-size: 18px;
81
  padding: 15px;
82
+ margin-bottom: 20px;
83
+ width: 100%;
84
+ box-sizing: border-box;
 
85
  }
86
  #result_output_box {
87
  border-radius: 10px;
 
89
  font-size: 18px;
90
  padding: 15px;
91
  background-color: #2E2E3F;
92
+ margin-top: 10px;
93
+ width: 100%;
94
+ box-sizing: border-box;
95
  }
96
  body {
97
  background: #1E1E2F;
98
  color: #E1E1E6;
99
  font-family: 'Aptos', sans-serif;
100
  padding: 20px;
 
101
  }
102
  .gradio-container {
103
  border: 2px solid #4CAF50;
104
  border-radius: 15px;
105
  padding: 30px;
106
  box-shadow: 0px 0px 20px rgba(0,255,0,0.6);
107
+ max-width: 700px;
108
+ margin: auto;
 
 
109
  }
110
+ h1 {
111
  text-align: center;
112
+ font-size: 36px;
113
  font-weight: bold;
114
+ }
115
+ h2 {
116
+ text-align: left;
117
+ font-size: 28px;
118
+ }
119
+ .highlight-human {
120
+ color: #4CAF50;
121
+ font-weight: bold;
122
+ background: rgba(76, 175, 80, 0.2);
123
+ padding: 5px;
124
+ border-radius: 8px;
125
+ }
126
+ .highlight-ai {
127
+ color: #FF5733;
128
+ font-weight: bold;
129
+ background: rgba(255, 87, 51, 0.2);
130
+ padding: 5px;
131
+ border-radius: 8px;
132
+ }
133
+ #bottom_text {
134
+ text-align: center;
135
+ margin-top: 50px;
136
+ font-weight: bold;
137
+ font-size: 20px;
138
+ color: #E1E1E6;
139
  }
140
  """
141
  )
142
 
143
+ def launch_app():
144
  iface.launch(share=True)
145
+ print(bottom_text)
146
+
147
+ if __name__ == "__main__":
148
+ launch_app()