Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,10 +34,10 @@ def predict_sentiment(text):
|
|
| 34 |
def process_file(file):
|
| 35 |
df = pd.read_csv(file.name)
|
| 36 |
|
| 37 |
-
if "
|
| 38 |
return "CSV must contain a 'text' column.", None
|
| 39 |
|
| 40 |
-
df["predicted_sentiment"] = df["
|
| 41 |
|
| 42 |
# Optional evaluation if ground truth exists
|
| 43 |
f1 = None
|
|
|
|
| 34 |
def process_file(file):
|
| 35 |
df = pd.read_csv(file.name)
|
| 36 |
|
| 37 |
+
if "Review" not in df.columns:
|
| 38 |
return "CSV must contain a 'text' column.", None
|
| 39 |
|
| 40 |
+
df["predicted_sentiment"] = df["Review"].astype(str).apply(predict_sentiment)
|
| 41 |
|
| 42 |
# Optional evaluation if ground truth exists
|
| 43 |
f1 = None
|