Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,6 +13,7 @@ def load_data(file):
|
|
| 13 |
if file is None:
|
| 14 |
return None, [], pd.DataFrame(), "", ""
|
| 15 |
try:
|
|
|
|
| 16 |
if file.name.endswith(".csv"):
|
| 17 |
df = pd.read_csv(file.name)
|
| 18 |
else:
|
|
@@ -96,7 +97,6 @@ def train_model(df, target_col, feature_cols):
|
|
| 96 |
def generate_help_text(report_text):
|
| 97 |
# Simple heuristics to parse classification_report for dynamic help
|
| 98 |
if "precision" in report_text and "recall" in report_text:
|
| 99 |
-
# Extract macro avg precision and recall
|
| 100 |
try:
|
| 101 |
macro_line = re.search(r'macro avg\s+([\d\.]+)\s+([\d\.]+)\s+([\d\.]+)', report_text)
|
| 102 |
if macro_line:
|
|
|
|
| 13 |
if file is None:
|
| 14 |
return None, [], pd.DataFrame(), "", ""
|
| 15 |
try:
|
| 16 |
+
# file is a tempfile-like object; use file.name to read
|
| 17 |
if file.name.endswith(".csv"):
|
| 18 |
df = pd.read_csv(file.name)
|
| 19 |
else:
|
|
|
|
| 97 |
def generate_help_text(report_text):
|
| 98 |
# Simple heuristics to parse classification_report for dynamic help
|
| 99 |
if "precision" in report_text and "recall" in report_text:
|
|
|
|
| 100 |
try:
|
| 101 |
macro_line = re.search(r'macro avg\s+([\d\.]+)\s+([\d\.]+)\s+([\d\.]+)', report_text)
|
| 102 |
if macro_line:
|