Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- inference.py +1 -0
- server/tasks.py +3 -1
- validate-submission.sh +5 -3
inference.py
CHANGED
|
@@ -35,6 +35,7 @@ async def _run_task(task_id: int):
|
|
| 35 |
action_schema = DataCleaningAction.model_json_schema()
|
| 36 |
|
| 37 |
async with DataCleaningEnv(base_url="http://localhost:8000") as env:
|
|
|
|
| 38 |
obs_res = await env.reset(task_id=task_id)
|
| 39 |
obs = obs_res.observation
|
| 40 |
|
|
|
|
| 35 |
action_schema = DataCleaningAction.model_json_schema()
|
| 36 |
|
| 37 |
async with DataCleaningEnv(base_url="http://localhost:8000") as env:
|
| 38 |
+
# async with DataCleaningEnv(base_url="https://kousiksasmal-data-cleaning-env.hf.space") as env:
|
| 39 |
obs_res = await env.reset(task_id=task_id)
|
| 40 |
obs = obs_res.observation
|
| 41 |
|
server/tasks.py
CHANGED
|
@@ -17,9 +17,11 @@ class DataCleaningTask:
|
|
| 17 |
|
| 18 |
# Calculate how many rows match exactly
|
| 19 |
match_count = 0
|
|
|
|
| 20 |
for current_row in current_data:
|
| 21 |
-
if current_row in
|
| 22 |
match_count += 1
|
|
|
|
| 23 |
|
| 24 |
# Calculate precision and recall
|
| 25 |
precision = match_count / len(current_data) if len(current_data) > 0 else 0.0
|
|
|
|
| 17 |
|
| 18 |
# Calculate how many rows match exactly
|
| 19 |
match_count = 0
|
| 20 |
+
target_copy = list(self.target_data)
|
| 21 |
for current_row in current_data:
|
| 22 |
+
if current_row in target_copy:
|
| 23 |
match_count += 1
|
| 24 |
+
target_copy.remove(current_row)
|
| 25 |
|
| 26 |
# Calculate precision and recall
|
| 27 |
precision = match_count / len(current_data) if len(current_data) > 0 else 0.0
|
validate-submission.sh
CHANGED
|
@@ -135,17 +135,19 @@ fi
|
|
| 135 |
|
| 136 |
if [ -f "$REPO_DIR/Dockerfile" ]; then
|
| 137 |
DOCKER_CONTEXT="$REPO_DIR"
|
|
|
|
| 138 |
elif [ -f "$REPO_DIR/server/Dockerfile" ]; then
|
| 139 |
-
DOCKER_CONTEXT="$REPO_DIR
|
|
|
|
| 140 |
else
|
| 141 |
fail "No Dockerfile found in repo root or server/ directory"
|
| 142 |
stop_at "Step 2"
|
| 143 |
fi
|
| 144 |
|
| 145 |
-
log " Found Dockerfile
|
| 146 |
|
| 147 |
BUILD_OK=false
|
| 148 |
-
BUILD_OUTPUT=$(run_with_timeout "$DOCKER_BUILD_TIMEOUT" docker build "$DOCKER_CONTEXT" 2>&1) && BUILD_OK=true
|
| 149 |
|
| 150 |
if [ "$BUILD_OK" = true ]; then
|
| 151 |
pass "Docker build succeeded"
|
|
|
|
| 135 |
|
| 136 |
if [ -f "$REPO_DIR/Dockerfile" ]; then
|
| 137 |
DOCKER_CONTEXT="$REPO_DIR"
|
| 138 |
+
DOCKER_FILE="$REPO_DIR/Dockerfile"
|
| 139 |
elif [ -f "$REPO_DIR/server/Dockerfile" ]; then
|
| 140 |
+
DOCKER_CONTEXT="$REPO_DIR"
|
| 141 |
+
DOCKER_FILE="$REPO_DIR/server/Dockerfile"
|
| 142 |
else
|
| 143 |
fail "No Dockerfile found in repo root or server/ directory"
|
| 144 |
stop_at "Step 2"
|
| 145 |
fi
|
| 146 |
|
| 147 |
+
log " Found Dockerfile at $DOCKER_FILE"
|
| 148 |
|
| 149 |
BUILD_OK=false
|
| 150 |
+
BUILD_OUTPUT=$(run_with_timeout "$DOCKER_BUILD_TIMEOUT" docker build -f "$DOCKER_FILE" "$DOCKER_CONTEXT" 2>&1) && BUILD_OK=true
|
| 151 |
|
| 152 |
if [ "$BUILD_OK" = true ]; then
|
| 153 |
pass "Docker build succeeded"
|