Spaces:
Sleeping
Sleeping
Commit
·
efbae10
1
Parent(s):
66b46d9
add
Browse files
app.py
CHANGED
|
@@ -26,9 +26,9 @@ ARTICLE = r"""<center>
|
|
| 26 |
|
| 27 |
|
| 28 |
# load data
|
| 29 |
-
def load_data(
|
| 30 |
"""Load dataset (keep only 500 rows for efficiency)"""
|
| 31 |
-
data = pd.read_csv(
|
| 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.
|
| 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 |
|