kaisex commited on
Commit
221ee1e
·
verified ·
1 Parent(s): 3bf9dc7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -6
app.py CHANGED
@@ -42,7 +42,7 @@ def predict(image, model_type):
42
  pred_class = torch.argmax(probs, dim=1).item()
43
  confidence = probs[0][pred_class].item()
44
 
45
- label = "NSFW" if pred_class == 1 else "SFW"
46
  return f"""
47
  <div class='result-box'>
48
  <strong>Model:</strong> {model_type}<br>
@@ -54,10 +54,10 @@ def predict(image, model_type):
54
  # Custom glow box CSS
55
  custom_css = """
56
  .result-box {
57
- background-color: oklch(0.718 0.202 349.761);
58
  padding: 20px;
59
  border-radius: 12px;
60
- box-shadow: 0 0 15px oklch(0.718 0.202 349.761);
61
  color: white;
62
  font-size: 1.2rem;
63
  text-align: center;
@@ -69,10 +69,9 @@ custom_css = """
69
 
70
  # Gradio UI
71
  with gr.Blocks(css=custom_css) as demo:
72
- gr.Markdown("## NSFW Detector (Human + Anime/Cartoon)")
73
  gr.Markdown(
74
- "Upload an image and select the appropriate model. The system will detect whether the content is NSFW or SFW. "
75
- "This is a side project. Results are not guaranteed. No images are stored."
76
  )
77
 
78
  with gr.Row():
@@ -85,5 +84,18 @@ with gr.Blocks(css=custom_css) as demo:
85
  image_input.change(fn=predict, inputs=[image_input, model_choice], outputs=output_box)
86
  model_choice.change(fn=predict, inputs=[image_input, model_choice], outputs=output_box)
87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  if __name__ == "__main__":
89
  demo.launch()
 
42
  pred_class = torch.argmax(probs, dim=1).item()
43
  confidence = probs[0][pred_class].item()
44
 
45
+ label = "NSFW" if pred_class == 0 else "SFW"
46
  return f"""
47
  <div class='result-box'>
48
  <strong>Model:</strong> {model_type}<br>
 
54
  # Custom glow box CSS
55
  custom_css = """
56
  .result-box {
57
+ background-color: black; /* dark inside */
58
  padding: 20px;
59
  border-radius: 12px;
60
+ box-shadow: 0 0 20px oklch(0.718 0.202 349.761); /* outer glow only */
61
  color: white;
62
  font-size: 1.2rem;
63
  text-align: center;
 
69
 
70
  # Gradio UI
71
  with gr.Blocks(css=custom_css) as demo:
72
+ gr.Markdown("## NSFW Detector (Human and Anime/Cartoon)")
73
  gr.Markdown(
74
+ "Upload an img and select the appropriate model. The system will detect whether the content is NSFW or SFW. "
 
75
  )
76
 
77
  with gr.Row():
 
84
  image_input.change(fn=predict, inputs=[image_input, model_choice], outputs=output_box)
85
  model_choice.change(fn=predict, inputs=[image_input, model_choice], outputs=output_box)
86
 
87
+ gr.Markdown(
88
+ "<div class='disclaimer'>This is a side project. Results are not guaranteed. No images are stored.</div>"
89
+ )
90
+ .disclaimer {
91
+ color: white;
92
+ font-size: 0.9rem;
93
+ text-align: center;
94
+ margin-top: 40px;
95
+ text-shadow: 0 0 10px oklch(0.718 0.202 349.761); /* soft outer glow */
96
+ }
97
+
98
+
99
+
100
  if __name__ == "__main__":
101
  demo.launch()