Spaces:
Build error
Build error
feat: Improve handling of number of tweets setting
Browse files
app.py
CHANGED
@@ -73,7 +73,7 @@ def generate_plot(
|
|
73 |
with st.spinner("Reducing dimensionality..."):
|
74 |
embeddings_2d = get_tsne_embeddings(embeddings)
|
75 |
plot = draw_interactive_scatter_plot(
|
76 |
-
df, embeddings_2d[:, 0], embeddings_2d[:, 1], encoded_labels
|
77 |
)
|
78 |
return plot
|
79 |
|
@@ -107,7 +107,8 @@ if tw_user:
|
|
107 |
tweets_response = client.get_users_tweets(usr.data.id, max_results=current_sample)
|
108 |
tweets_objs += tweets_response.data
|
109 |
tw_sample -= current_sample
|
110 |
-
|
|
|
111 |
tweets_objs += tweets_response.data
|
112 |
tweets_txt = [tweet.text for tweet in tweets_objs]
|
113 |
labels = [0] * len(tweets_txt)
|
|
|
73 |
with st.spinner("Reducing dimensionality..."):
|
74 |
embeddings_2d = get_tsne_embeddings(embeddings)
|
75 |
plot = draw_interactive_scatter_plot(
|
76 |
+
df, embeddings_2d[:, 0], embeddings_2d[:, 1], encoded_labels, labels, 'text', 'label'
|
77 |
)
|
78 |
return plot
|
79 |
|
|
|
107 |
tweets_response = client.get_users_tweets(usr.data.id, max_results=current_sample)
|
108 |
tweets_objs += tweets_response.data
|
109 |
tw_sample -= current_sample
|
110 |
+
if tw_sample > 0:
|
111 |
+
tweets_response = client.get_users_tweets(usr.data.id, max_results=tw_sample)
|
112 |
tweets_objs += tweets_response.data
|
113 |
tweets_txt = [tweet.text for tweet in tweets_objs]
|
114 |
labels = [0] * len(tweets_txt)
|