Spaces:
Sleeping
Sleeping
Update modules/sentiment.py
Browse files- modules/sentiment.py +29 -29
modules/sentiment.py
CHANGED
@@ -1,39 +1,39 @@
|
|
1 |
-
from transformers import pipeline
|
2 |
-
import gradio as gr
|
3 |
|
4 |
-
classifier = pipeline("sentiment-analysis", model="cardiffnlp/twitter-xlm-roberta-base-sentiment", framework="pt")
|
5 |
|
6 |
-
def sentiment_analysis(message, history):
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
|
14 |
-
with gr.Blocks() as demo:
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
|
21 |
-
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
|
28 |
-
|
29 |
|
30 |
-
|
31 |
|
32 |
-
|
33 |
-
|
34 |
|
35 |
-
|
36 |
-
|
37 |
|
38 |
-
if __name__ == "__main__":
|
39 |
-
|
|
|
1 |
+
# from transformers import pipeline
|
2 |
+
# import gradio as gr
|
3 |
|
4 |
+
# classifier = pipeline("sentiment-analysis", model="cardiffnlp/twitter-xlm-roberta-base-sentiment", framework="pt")
|
5 |
|
6 |
+
# def sentiment_analysis(message, history):
|
7 |
+
# """
|
8 |
+
# Funci贸n para analizar el sentimiento de un mensaje.
|
9 |
+
# Retorna la etiqueta de sentimiento con su probabilidad.
|
10 |
+
# """
|
11 |
+
# result = classifier(message)
|
12 |
+
# return f"Sentimiento : {result[0]['label']} (Probabilidad: {result[0]['score']:.2f})"
|
13 |
|
14 |
+
# with gr.Blocks() as demo:
|
15 |
+
# gr.Markdown("""
|
16 |
+
# # An谩lisis de Sentimientos
|
17 |
+
# Esta aplicaci贸n utiliza un modelo de Machine Learning para analizar el sentimiento de los mensajes ingresados.
|
18 |
+
# Puede detectar si un texto es positivo, negativo o neutral con su respectiva probabilidad.
|
19 |
+
# """)
|
20 |
|
21 |
+
# chat = gr.ChatInterface(sentiment_analysis, type="messages")
|
22 |
|
23 |
+
# gr.Markdown("""
|
24 |
+
# ---
|
25 |
+
# ### Con茅ctate conmigo:
|
26 |
+
# [Instagram 馃摳](https://www.instagram.com/srjosueaaron/)
|
27 |
|
28 |
+
# [TikTok 馃幍](https://www.tiktok.com/@srjosueaaron)
|
29 |
|
30 |
+
# [YouTube 馃幀](https://www.youtube.com/@srjosueaaron)
|
31 |
|
32 |
+
# ---
|
33 |
+
# Demostraci贸n de An谩lisis de Sentimientos usando el modelo de [CardiffNLP](https://huggingface.co/cardiffnlp/twitter-xlm-roberta-base-sentiment).
|
34 |
|
35 |
+
# Desarrollado con 鉂わ笍 por [@srjosueaaron](https://www.instagram.com/srjosueaaron/).
|
36 |
+
# """)
|
37 |
|
38 |
+
# if __name__ == "__main__":
|
39 |
+
# demo.launch()
|