MarMont commited on
Commit
a212c2d
1 Parent(s): 97cf463

fixed format of topic keywords output

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -313,7 +313,7 @@ def dataframeProcessing(dataset):
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,7 +341,7 @@ def dataframeProcessing(dataset):
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,6 +352,6 @@ iface = gr.Interface(fn=dataframeProcessing,
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()
 
313
 
314
  for topic in lda_topics:
315
  print(topic)
316
+ lda_topics_string += 'Topic ' + str(topic[0]) + '\n' + str(topic[1]) + '\n\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 lda_topics_string, output_df
345
 
346
  def greet(name):
347
  return "Hello " + name + "!!"
 
352
  "bgc-december",
353
  "bonifacio global city-december"],
354
  label="Dataset"),
355
+ outputs=["text",
356
+ gr.Dataframe(headers=['original_tweets', 'max_topic'])])
357
  iface.launch()