Add application file
Browse files- .gitignore +1 -0
- .gradio/flagged/dataset1.csv +3 -0
- README.md +1 -1
- app.py +19 -3
- requirements.txt +6 -0
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
venv
|
.gradio/flagged/dataset1.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name,output,timestamp
|
| 2 |
+
Fede,Hello Fede!!,2025-04-21 17:12:29.998038
|
| 3 |
+
Fede,Hello Fede!!,2025-04-21 17:12:31.430629
|
README.md
CHANGED
|
@@ -5,7 +5,7 @@ colorFrom: red
|
|
| 5 |
colorTo: blue
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.25.2
|
| 8 |
-
app_file:
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
|
|
|
| 5 |
colorTo: blue
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 5.25.2
|
| 8 |
+
app_file: app2.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
app.py
CHANGED
|
@@ -1,7 +1,23 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
return "Hello " + name + "!!"
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
|
| 4 |
+
clasificador = pipeline("sentiment-analysis", model="pysentimiento/robertuito-sentiment-analysis")
|
|
|
|
| 5 |
|
| 6 |
+
def puntuacion_sentimientos(texto):
|
| 7 |
+
resultado = clasificador(texto)
|
| 8 |
+
print(resultado)
|
| 9 |
+
etiqueta = resultado[0]["label"]
|
| 10 |
+
if(etiqueta == "POS"):
|
| 11 |
+
respuesta = "Tu frase es positiva"
|
| 12 |
+
elif etiqueta == "NEG":
|
| 13 |
+
respuesta = "Tu grase es negativa"
|
| 14 |
+
else:
|
| 15 |
+
respuesta = "Ni fu ni fa"
|
| 16 |
+
return respuesta
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
demo = gr.Interface(fn=puntuacion_sentimientos,
|
| 20 |
+
inputs="text",
|
| 21 |
+
outputs="text",
|
| 22 |
+
description="Esta es nuestra interfaz para probar <strong>modelos de IA</strong>")
|
| 23 |
demo.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio==5.20.0
|
| 2 |
+
transformers==4.49.0
|
| 3 |
+
torch==2.6.0
|
| 4 |
+
diffusers==0.32.2
|
| 5 |
+
accelerate==1.5.2
|
| 6 |
+
pydantic==2.10.6
|