srjosueaaron commited on
Commit
8af3323
verified
1 Parent(s): 17cf9b1

Upload 3 files

Browse files
Files changed (3) hide show
  1. README.md +15 -14
  2. app.py +37 -0
  3. requirements.txt +2 -0
README.md CHANGED
@@ -1,14 +1,15 @@
1
- ---
2
- title: Sentiment Analysis Demo
3
- emoji: 馃寲
4
- colorFrom: red
5
- colorTo: yellow
6
- sdk: gradio
7
- sdk_version: 5.21.0
8
- app_file: app.py
9
- pinned: false
10
- license: mit
11
- short_description: Puede detectar si un texto es positivo, negativo o neutral
12
- ---
13
-
14
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
+ ---
2
+ title: "An谩lisis de Sentimientos"
3
+ emoji: "馃檪"
4
+ colorFrom: "blue"
5
+ colorTo: "purple"
6
+ sdk: "gradio"
7
+
8
+ models:
9
+ - "cardiffnlp/twitter-xlm-roberta-base-sentiment"
10
+ tags:
11
+ - "sentiment-analysis"
12
+ - "gradio"
13
+ - "nlp"
14
+ - "transformers"
15
+ ---
app.py ADDED
@@ -0,0 +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()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ gradio
2
+ transformers[sentencepiece]