Spaces:
Running
on
Zero
Running
on
Zero
Update app.py (#1)
Browse files- Update app.py (e4af447d81d5da3954fa3b46a5ed6bc8a983a71e)
app.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import os
|
2 |
import time
|
|
|
3 |
import gradio as gr
|
4 |
import pandas as pd
|
5 |
|
@@ -85,8 +86,13 @@ def load_and_classify_csv_dataframe(file, text_field, event_model, threshold):
|
|
85 |
|
86 |
df["event_label"] = labels
|
87 |
df["model_score"] = scores
|
|
|
|
|
|
|
|
|
88 |
|
89 |
-
result_df = df[[text_field, "event_label", "model_score", "tweet_id"]].copy()
|
|
|
90 |
result_df["tweet_id"] = result_df["tweet_id"].astype(str)
|
91 |
|
92 |
filters = list(result_df["event_label"].unique())
|
|
|
1 |
import os
|
2 |
import time
|
3 |
+
import random
|
4 |
import gradio as gr
|
5 |
import pandas as pd
|
6 |
|
|
|
86 |
|
87 |
df["event_label"] = labels
|
88 |
df["model_score"] = scores
|
89 |
+
|
90 |
+
if 'tweet_id' not in df.columns:
|
91 |
+
generated_ids = [''.join(random.choices(string.digits, k=10)) for _ in range(len(df))]
|
92 |
+
df["tweet_id"] = generated_ids
|
93 |
|
94 |
+
#result_df = df[[text_field, "event_label", "model_score", "tweet_id"]].copy()
|
95 |
+
result_df = df.copy()
|
96 |
result_df["tweet_id"] = result_df["tweet_id"].astype(str)
|
97 |
|
98 |
filters = list(result_df["event_label"].unique())
|