Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
text
Sub-tasks:
sentiment-classification
Languages:
Spanish
Size:
10K - 100K
License:
Upload 3 files
Browse files- app.py +33 -19
- goemotions_es_demo_subset_fixed.json +0 -0
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -1,29 +1,43 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import json
|
|
|
|
| 3 |
|
| 4 |
-
# Cargar
|
| 5 |
-
with open("
|
| 6 |
data = json.load(f)
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
| 20 |
|
|
|
|
| 21 |
demo = gr.Interface(
|
| 22 |
-
fn=
|
| 23 |
-
inputs=
|
| 24 |
-
outputs=
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
)
|
| 28 |
|
| 29 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import json
|
| 3 |
+
import random
|
| 4 |
|
| 5 |
+
# Cargar el dataset demo
|
| 6 |
+
with open("goemotions_es_demo_subset_fixed.json", "r", encoding="utf-8") as f:
|
| 7 |
data = json.load(f)
|
| 8 |
|
| 9 |
+
# Función para mostrar una muestra aleatoria
|
| 10 |
+
def mostrar_muestra():
|
| 11 |
+
ejemplo = random.choice(data)
|
| 12 |
+
return (
|
| 13 |
+
ejemplo["persona"],
|
| 14 |
+
ejemplo["contexto_usuario"],
|
| 15 |
+
ejemplo["respuesta_asistente"],
|
| 16 |
+
ejemplo["emotion"],
|
| 17 |
+
ejemplo["intencion"],
|
| 18 |
+
ejemplo["tono"],
|
| 19 |
+
ejemplo["energia"],
|
| 20 |
+
"✅ Coherente" if ejemplo["coherente"] else "⚠️ Incoherente"
|
| 21 |
+
)
|
| 22 |
|
| 23 |
+
# Interfaz de salida
|
| 24 |
demo = gr.Interface(
|
| 25 |
+
fn=mostrar_muestra,
|
| 26 |
+
inputs=[],
|
| 27 |
+
outputs=[
|
| 28 |
+
gr.Textbox(label="🧠 Persona (contexto)"),
|
| 29 |
+
gr.Textbox(label="💬 Usuario dice"),
|
| 30 |
+
gr.Textbox(label="🤖 Asistente responde"),
|
| 31 |
+
gr.Textbox(label="🎭 Emoción principal"),
|
| 32 |
+
gr.Textbox(label="🎯 Intención"),
|
| 33 |
+
gr.Textbox(label="🎙️ Tono conversacional"),
|
| 34 |
+
gr.Number(label="⚡ Nivel de energía"),
|
| 35 |
+
gr.Textbox(label="📌 Coherencia")
|
| 36 |
+
],
|
| 37 |
+
title="GoEmotions-ES Demo (Lucio-Rhapsody)",
|
| 38 |
+
description="Explora muestras aleatorias del dataset emocional en español curado por Lucio-Rhapsody. Este espacio no utiliza un modelo, sino el dataset demo.",
|
| 39 |
+
allow_flagging="never",
|
| 40 |
+
live=False
|
| 41 |
)
|
| 42 |
|
| 43 |
demo.launch()
|
goemotions_es_demo_subset_fixed.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
gradio>=3.0
|