cesaenv commited on
Commit
2cca3df
verified
1 Parent(s): a81bc72

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Cargar el modelo desde Hugging Face
5
+ classifier = pipeline("sentiment-analysis", model="cesaenv/rottenTomatoes")
6
+
7
+ # Definir la funci贸n de clasificaci贸n
8
+ def classify_text(text):
9
+ result = classifier(text)
10
+ return result[0]['label'], result[0]['score']
11
+
12
+ # Crear la interfaz de Gradio
13
+ iface = gr.Interface(
14
+ fn=classify_text,
15
+ inputs=gr.inputs.Textbox(lines=2, placeholder="Escribe un texto aqu铆..."),
16
+ outputs=["label", "number"],
17
+ title="Clasificaci贸n de Texto",
18
+ description="Clasificador de texto usando un modelo de Hugging Face."
19
+ )
20
+
21
+ # Ejecutar la aplicaci贸n
22
+ iface.launch()