MarMont commited on
Commit
97cf463
·
1 Parent(s): 438b8e1

show topic keywords

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -309,9 +309,11 @@ def dataframeProcessing(dataset):
309
 
310
  topics = []
311
  filters = [lambda x: x.lower(), strip_punctuation, strip_numeric]
 
312
 
313
  for topic in lda_topics:
314
  print(topic)
 
315
  topics.append(preprocess_string(topic[1], filters))
316
 
317
  df['topic'] = [sorted(lda_model_final[corpus][text][0]) for text in range(len(df['original_tweets']))]
@@ -339,7 +341,7 @@ def dataframeProcessing(dataset):
339
 
340
  output_df = df[['original_tweets', 'max_topic']].copy()
341
 
342
- return output_df
343
 
344
  def greet(name):
345
  return "Hello " + name + "!!"
@@ -350,5 +352,6 @@ iface = gr.Interface(fn=dataframeProcessing,
350
  "bgc-december",
351
  "bonifacio global city-december"],
352
  label="Dataset"),
353
- outputs=gr.Dataframe(headers=['original_tweets', 'max_topic']))
 
354
  iface.launch()
 
309
 
310
  topics = []
311
  filters = [lambda x: x.lower(), strip_punctuation, strip_numeric]
312
+ lda_topics_string = ''
313
 
314
  for topic in lda_topics:
315
  print(topic)
316
+ lda_topics_string += str(topic[0]) + ' ' + str(topic[1]) + '\n'
317
  topics.append(preprocess_string(topic[1], filters))
318
 
319
  df['topic'] = [sorted(lda_model_final[corpus][text][0]) for text in range(len(df['original_tweets']))]
 
341
 
342
  output_df = df[['original_tweets', 'max_topic']].copy()
343
 
344
+ return output_df, lda_topics_string
345
 
346
  def greet(name):
347
  return "Hello " + name + "!!"
 
352
  "bgc-december",
353
  "bonifacio global city-december"],
354
  label="Dataset"),
355
+ outputs=[gr.Dataframe(headers=['original_tweets', 'max_topic']),
356
+ "text"])
357
  iface.launch()