DrGabrielLopez commited on
Commit
efbae10
1 Parent(s): 66b46d9
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -26,9 +26,9 @@ ARTICLE = r"""<center>
26
 
27
 
28
  # load data
29
- def load_data(file_obj):
30
  """Load dataset (keep only 500 rows for efficiency)"""
31
- data = pd.read_csv(file_obj, error_bad_lines=False, nrows=500)
32
  assert "text" in data.columns, "The data must have a column named 'text'"
33
  return data
34
 
@@ -147,7 +147,7 @@ with blocks:
147
  topics_text = gr.Textbox(label="Topics", lines=50)
148
  gr.Markdown(ARTICLE)
149
  # event listeners
150
- in_file = in_file.change(inputs=in_file, outputs=in_data, fn=load_data)
151
  # submit_button.click(inputs=in_data, outputs=out_dataset, fn=run_bert_tokenization)
152
  # out_dataset.change(inputs=out_dataset, outputs=embedding_plot, fn=run_bertopic)
153
 
 
26
 
27
 
28
  # load data
29
+ def load_data(file_path):
30
  """Load dataset (keep only 500 rows for efficiency)"""
31
+ data = pd.read_csv(file_path, error_bad_lines=False, nrows=500)
32
  assert "text" in data.columns, "The data must have a column named 'text'"
33
  return data
34
 
 
147
  topics_text = gr.Textbox(label="Topics", lines=50)
148
  gr.Markdown(ARTICLE)
149
  # event listeners
150
+ in_file = in_file.upload(inputs=in_file.value, outputs=in_data, fn=load_data)
151
  # submit_button.click(inputs=in_data, outputs=out_dataset, fn=run_bert_tokenization)
152
  # out_dataset.change(inputs=out_dataset, outputs=embedding_plot, fn=run_bertopic)
153