added topic string column
Browse files
app.py
CHANGED
@@ -318,6 +318,8 @@ def dataframeProcessing(dataset):
|
|
318 |
|
319 |
df['topic'] = [sorted(lda_model_final[corpus][text][0]) for text in range(len(df['original_tweets']))]
|
320 |
|
|
|
|
|
321 |
df = df[df['topic'].map(lambda d: len(d)) > 0]
|
322 |
df['topic'][0]
|
323 |
|
@@ -339,7 +341,7 @@ def dataframeProcessing(dataset):
|
|
339 |
print('Topic ', i)
|
340 |
print(rep_tweets[:5])
|
341 |
|
342 |
-
output_df = df[['
|
343 |
|
344 |
return lda_topics_string, output_df
|
345 |
|
@@ -353,5 +355,5 @@ iface = gr.Interface(fn=dataframeProcessing,
|
|
353 |
"bonifacio global city-december"],
|
354 |
label="Dataset"),
|
355 |
outputs=["text",
|
356 |
-
gr.Dataframe(headers=['
|
357 |
iface.launch()
|
|
|
318 |
|
319 |
df['topic'] = [sorted(lda_model_final[corpus][text][0]) for text in range(len(df['original_tweets']))]
|
320 |
|
321 |
+
df['topic_string'] = df['topic'].astype(str)
|
322 |
+
|
323 |
df = df[df['topic'].map(lambda d: len(d)) > 0]
|
324 |
df['topic'][0]
|
325 |
|
|
|
341 |
print('Topic ', i)
|
342 |
print(rep_tweets[:5])
|
343 |
|
344 |
+
output_df = df[['topic_string', 'original_tweets']].copy()
|
345 |
|
346 |
return lda_topics_string, output_df
|
347 |
|
|
|
355 |
"bonifacio global city-december"],
|
356 |
label="Dataset"),
|
357 |
outputs=["text",
|
358 |
+
gr.Dataframe(headers=['topic_string', 'original_tweets'])])
|
359 |
iface.launch()
|