Update app.py
Browse files
app.py
CHANGED
|
@@ -40,10 +40,11 @@ def predict(texts, threshold=0.3):
|
|
| 40 |
def predict_bulk(texts_str, threshold=0.3):
|
| 41 |
texts = [line.strip() for line in texts_str.split("\n") if line.strip()]
|
| 42 |
results = predict(texts, threshold)
|
| 43 |
-
|
| 44 |
-
formatted = "\n".join(f"{t}: " + ", ".join(f"**{e}**" for e in r.split(", ")) for t, r in zip(texts, results))
|
| 45 |
return formatted
|
| 46 |
|
|
|
|
|
|
|
| 47 |
# Process CSV file upload
|
| 48 |
def predict_file(file_obj, threshold=0.3):
|
| 49 |
df = pd.read_csv(file_obj.name)
|
|
|
|
| 40 |
def predict_bulk(texts_str, threshold=0.3):
|
| 41 |
texts = [line.strip() for line in texts_str.split("\n") if line.strip()]
|
| 42 |
results = predict(texts, threshold)
|
| 43 |
+
formatted = "\n\n".join(f"{t}: " + ", ".join(f"**{e}**" for e in r.split(", ")) for t, r in zip(texts, results))
|
|
|
|
| 44 |
return formatted
|
| 45 |
|
| 46 |
+
|
| 47 |
+
|
| 48 |
# Process CSV file upload
|
| 49 |
def predict_file(file_obj, threshold=0.3):
|
| 50 |
df = pd.read_csv(file_obj.name)
|