Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- server/app.py +7 -2
server/app.py
CHANGED
|
@@ -133,11 +133,16 @@ def run_baseline() -> dict:
|
|
| 133 |
|
| 134 |
# Robustly find JSON in potentially noisy stdout
|
| 135 |
stdout = result.stdout.strip()
|
|
|
|
|
|
|
| 136 |
match = re.search(r'(\{.*\})', stdout, re.DOTALL)
|
| 137 |
if match:
|
| 138 |
-
|
|
|
|
|
|
|
|
|
|
| 139 |
|
| 140 |
-
raise ValueError(f"No JSON found
|
| 141 |
|
| 142 |
except Exception as e:
|
| 143 |
raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
| 133 |
|
| 134 |
# Robustly find JSON in potentially noisy stdout
|
| 135 |
stdout = result.stdout.strip()
|
| 136 |
+
stderr = result.stderr.strip()
|
| 137 |
+
|
| 138 |
match = re.search(r'(\{.*\})', stdout, re.DOTALL)
|
| 139 |
if match:
|
| 140 |
+
try:
|
| 141 |
+
return json.loads(match.group(1))
|
| 142 |
+
except Exception as j_err:
|
| 143 |
+
raise ValueError(f"JSON Decode Error: {j_err}. Raw Match: {match.group(1)}")
|
| 144 |
|
| 145 |
+
raise ValueError(f"No JSON found. Stdout: {stdout[:100]}. Stderr: {stderr[:100]}. ReturnCode: {result.returncode}")
|
| 146 |
|
| 147 |
except Exception as e:
|
| 148 |
raise HTTPException(status_code=500, detail=str(e))
|