alejandroacho commited on
Commit
1ca89b6
1 Parent(s): bea11f1

first commit

Browse files
Files changed (3) hide show
  1. .gitignore +1 -0
  2. app.py +23 -0
  3. requirements.txt +3 -0
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ .idea
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Cargar el modelo de detecci贸n NSFW
5
+ nsfw_detector = pipeline("text-classification", model="ezb/NSFW-Prompt-Detector")
6
+
7
+ def detect_nsfw(text):
8
+ # Realizar la predicci贸n
9
+ result = nsfw_detector(text)
10
+ # Devolver la etiqueta y la puntuaci贸n
11
+ return result[0]['label'], result[0]['score']
12
+
13
+ # Definir la interfaz de Gradio
14
+ iface = gr.Interface(
15
+ fn=detect_nsfw,
16
+ inputs=gr.inputs.Textbox(lines=2, placeholder="Introduce el texto aqu铆..."),
17
+ outputs=["text", "number"],
18
+ title="Detector de Texto NSFW",
19
+ description="Introduce un texto para verificar si contiene contenido NSFW."
20
+ )
21
+
22
+ if __name__ == "__main__":
23
+ iface.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ transformers>=4.33.0
2
+ torch>=2.0.0
3
+ gradio>=3.34.0