Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,11 +10,12 @@ from statistics import mean
|
|
| 10 |
HFTOKEN = os.environ["HF_TOKEN"]
|
| 11 |
|
| 12 |
def load_and_classify_csv(file, text_field, event_model):
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
|
|
|
| 18 |
|
| 19 |
if text_field not in df.columns:
|
| 20 |
raise gr.Error(f"Error: Enter text column'{text_field}' not in CSV file.")
|
|
|
|
| 10 |
HFTOKEN = os.environ["HF_TOKEN"]
|
| 11 |
|
| 12 |
def load_and_classify_csv(file, text_field, event_model):
|
| 13 |
+
filepath = file.name
|
| 14 |
+
if ".csv" in filepath:
|
| 15 |
+
df = pd.read_csv(filepath)
|
| 16 |
+
else ".tsv" in filepath:
|
| 17 |
+
df = pd.read_table(filepath)
|
| 18 |
+
# print(file.name)
|
| 19 |
|
| 20 |
if text_field not in df.columns:
|
| 21 |
raise gr.Error(f"Error: Enter text column'{text_field}' not in CSV file.")
|