srjosueaaron commited on
Commit
902741b
verified
1 Parent(s): 37a8d0f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -37
app.py CHANGED
@@ -1,37 +1,37 @@
1
- from transformers import pipeline
2
- import gradio as gr
3
-
4
- classifier = pipeline("sentiment-analysis", model="cardiffnlp/twitter-xlm-roberta-base-sentiment")
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://img.shields.io/badge/Instagram-E4405F?style=for-the-badge&logo=instagram&logoColor=white)](https://www.instagram.com/srjosueaaron/)
27
- [![TikTok](https://img.shields.io/badge/TikTok-000000?style=for-the-badge&logo=tiktok&logoColor=white)](https://www.tiktok.com/@srjosueaaron)
28
- [![YouTube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/@srjosueaaron)
29
-
30
- ---
31
- Demostraci贸n de An谩lisis de Sentimientos usando el modelo de [CardiffNLP](https://huggingface.co/cardiffnlp/twitter-xlm-roberta-base-sentiment).
32
-
33
- Desarrollado con 鉂わ笍 por [@srjosueaaron](https://www.instagram.com/srjosueaaron/).
34
- """)
35
-
36
- if __name__ == "__main__":
37
- demo.launch()
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ classifier = pipeline("sentiment-analysis", model="cardiffnlp/twitter-xlm-roberta-base-sentiment")
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
+ [TikTok 馃幍](https://www.tiktok.com/@srjosueaaron)
28
+ [YouTube 馃幀](https://www.youtube.com/@srjosueaaron)
29
+
30
+ ---
31
+ Demostraci贸n de An谩lisis de Sentimientos usando el modelo de [CardiffNLP](https://huggingface.co/cardiffnlp/twitter-xlm-roberta-base-sentiment).
32
+
33
+ Desarrollado con 鉂わ笍 por [@srjosueaaron](https://www.instagram.com/srjosueaaron/).
34
+ """)
35
+
36
+ if __name__ == "__main__":
37
+ demo.launch()