Spaces:
Runtime error
Runtime error
Commit
·
a5ed634
1
Parent(s):
af06d05
Update app.py
Browse files
app.py
CHANGED
|
@@ -174,8 +174,9 @@ def tweets_localidad(buscar_localidad):
|
|
| 174 |
return tabla
|
| 175 |
|
| 176 |
def analizar_frase(frase):
|
| 177 |
-
|
| 178 |
-
|
|
|
|
| 179 |
predictions = pipeline_nlp(frase)
|
| 180 |
# convierte las predicciones en una lista de diccionarios
|
| 181 |
data = [{'Texto': frase, 'Prediccion': prediction['label'], 'Probabilidad': prediction['score']} for prediction in predictions]
|
|
@@ -184,8 +185,6 @@ def analizar_frase(frase):
|
|
| 184 |
df['Prediccion'] = np.where( df['Prediccion'] == 'LABEL_1', 'Sexista', 'No Sexista')
|
| 185 |
# muestra el DataFrame
|
| 186 |
tabla = st.table(df.reset_index(drop=True).head(5).style.applymap(color_survived, subset=['Prediccion']))
|
| 187 |
-
else:
|
| 188 |
-
tabla = st.text("Ingrese una frase")
|
| 189 |
|
| 190 |
return tabla
|
| 191 |
|
|
|
|
| 174 |
return tabla
|
| 175 |
|
| 176 |
def analizar_frase(frase):
|
| 177 |
+
if frase.empty:
|
| 178 |
+
tabla = st.text("Ingrese una frase")
|
| 179 |
+
else:
|
| 180 |
predictions = pipeline_nlp(frase)
|
| 181 |
# convierte las predicciones en una lista de diccionarios
|
| 182 |
data = [{'Texto': frase, 'Prediccion': prediction['label'], 'Probabilidad': prediction['score']} for prediction in predictions]
|
|
|
|
| 185 |
df['Prediccion'] = np.where( df['Prediccion'] == 'LABEL_1', 'Sexista', 'No Sexista')
|
| 186 |
# muestra el DataFrame
|
| 187 |
tabla = st.table(df.reset_index(drop=True).head(5).style.applymap(color_survived, subset=['Prediccion']))
|
|
|
|
|
|
|
| 188 |
|
| 189 |
return tabla
|
| 190 |
|