Spaces:
Runtime error
Runtime error
Commit
·
f352c0a
1
Parent(s):
4518611
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ import numpy as np
|
|
6 |
import regex as re
|
7 |
import pysentimiento
|
8 |
import geopy
|
|
|
9 |
|
10 |
from pysentimiento.preprocessing import preprocess_tweet
|
11 |
from geopy.geocoders import Nominatim
|
@@ -254,10 +255,10 @@ def tweets_localidad(buscar_localidad):
|
|
254 |
probability = np.amax(logits1,axis=1).flatten()
|
255 |
Tweets =['Últimos 50 Tweets'+' de '+ buscar_localidad]
|
256 |
df = pd.DataFrame(list(zip(text1, localidad,username, flat_predictions,probability)), columns = ['Tweets' ,'Localidad' , 'Usuario','Prediccion','Probabilidad'])
|
257 |
-
|
258 |
df['Prediccion']= np.where(df['Prediccion']== 0, 'No Sexista', 'Sexista')
|
259 |
#df['Tweets'] = df['Tweets'].str.replace('RT|@', '')
|
260 |
-
|
261 |
#df['Tweets'] = df['Tweets'].apply(lambda x: re.sub(r'[:;][-o^]?[)\]DpP3]|[(/\\]|[\U0001f600-\U0001f64f]|[\U0001f300-\U0001f5ff]|[\U0001f680-\U0001f6ff]|[\U0001f1e0-\U0001f1ff]','', x))
|
262 |
|
263 |
tabla = st.table(df.reset_index(drop=True).head(50).style.applymap(color_survived, subset=['Prediccion']))
|
|
|
6 |
import regex as re
|
7 |
import pysentimiento
|
8 |
import geopy
|
9 |
+
import matplotlib.pyplot as plt
|
10 |
|
11 |
from pysentimiento.preprocessing import preprocess_tweet
|
12 |
from geopy.geocoders import Nominatim
|
|
|
255 |
probability = np.amax(logits1,axis=1).flatten()
|
256 |
Tweets =['Últimos 50 Tweets'+' de '+ buscar_localidad]
|
257 |
df = pd.DataFrame(list(zip(text1, localidad,username, flat_predictions,probability)), columns = ['Tweets' ,'Localidad' , 'Usuario','Prediccion','Probabilidad'])
|
258 |
+
df_filtrado = df[df["Prediccion"] == 1 ]
|
259 |
df['Prediccion']= np.where(df['Prediccion']== 0, 'No Sexista', 'Sexista')
|
260 |
#df['Tweets'] = df['Tweets'].str.replace('RT|@', '')
|
261 |
+
|
262 |
#df['Tweets'] = df['Tweets'].apply(lambda x: re.sub(r'[:;][-o^]?[)\]DpP3]|[(/\\]|[\U0001f600-\U0001f64f]|[\U0001f300-\U0001f5ff]|[\U0001f680-\U0001f6ff]|[\U0001f1e0-\U0001f1ff]','', x))
|
263 |
|
264 |
tabla = st.table(df.reset_index(drop=True).head(50).style.applymap(color_survived, subset=['Prediccion']))
|