Alejandro-03 commited on
Commit
f2e85d3
·
verified ·
1 Parent(s): fc818f3

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Carga el modelo fine-tuneado desde tu cuenta
5
+ # Reemplaza con TU USUARIO y NOMBRE del modelo en Hugging Face
6
+ model_id = "Alejandro-03/fine-tuned-sentiment-v1"
7
+
8
+ classifier = pipeline("text-classification", model=model_id)
9
+
10
+ def classify_sentiment(text):
11
+ prediction = classifier(text)[0]
12
+ label = prediction["label"]
13
+ score = round(prediction["score"] * 100, 2)
14
+ return f"{label} ({score}%)"
15
+
16
+ demo = gr.Interface(
17
+ fn=classify_sentiment,
18
+ inputs="text",
19
+ outputs="text",
20
+ title="Clasificador de Sentimientos",
21
+ description="Escribe una frase en inglés para detectar si el sentimiento es positivo o negativo.",
22
+ theme="default"
23
+ )
24
+
25
+ demo.launch()