Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
AIcrowd
practice-challenges
aicrowd_CRDIO_challenge
Commits
516999a8
Commit
516999a8
authored
Jun 10, 2020
by
ashivani
Browse files
"added pipeline"
parent
746cef0f
Changes
3
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
0 → 100644
View file @
516999a8
stages
:
-
rails-update
-
test-baseline
-
submit-baseline
.aicrowd-setup
:
&aicrowd-setup
image
:
python:3.8
before_script
:
-
git clone https://github.com/AIcrowd/aicrowd-cli.git && cd aicrowd-cli
-
pip install -r requirements.txt
-
python setup.py develop
-
cd ..
-
aicrowd evaluations login -e "${SUPER_USER_EMAIL}" -p "${SUPER_USER_PASSWORD}"
rails-update
:
stage
:
rails-update
image
:
python:3.8-slim
before_script
:
-
pip install pyyaml requests markdown
script
:
-
python utils.py
only
:
changes
:
-
README.md
test-baseline
:
stage
:
test-baseline
image
:
python:3.8
before_script
:
-
apt install curl
-
curl -o /usr/local/bin/jq http://stedolan.github.io/jq/download/linux64/jq && chmod +x /usr/local/bin/jq
-
pip install yq
-
pip install jupyter
script
:
-
export BASELINE=`yq -r .official_baseline aicrowd.yaml | awk -F. '{print $1}'`
-
jupyter nbconvert --to python baselines/${BASELINE}.ipynb
-
ipython baselines/${BASELINE}.py
artifacts
:
paths
:
-
submission.csv
only
:
changes
:
-
baselines/*
submit-baseline
:
stage
:
submit-baseline
<<
:
*aicrowd-setup
script
:
-
apt install curl
-
curl -o /usr/local/bin/jq http://stedolan.github.io/jq/download/linux64/jq && chmod +x /usr/local/bin/jq
-
pip install yq
-
export CHALLENGE_NAME=`yq -r .challenge_name aicrowd.yaml`
-
export EVALUATIONS_API_TOKEN=`yq -r .aicrowd_evaluations_token ~/.aicrowd/config.yaml`
-
export GRADER_ID=`curl -k -X GET "https://evaluations-api.internal.k8s.aicrowd.com/v1/graders/?name=${CHALLENGE_NAME}"
-H "accept:application/json"
-H "AUTHORIZATION:${EVALUATIONS_API_TOKEN}" | jq '.[length-1].id'`
-
aicrowd evaluations submission create --file ./submission.csv -g ${GRADER_ID} --wait
only
:
changes
:
-
baselines/*
aicrowd.yaml
View file @
516999a8
---
challenge_name
:
aicrowd_CRDIO_challenge
challenge_name
:
crdio
evaluation_repo
:
git@gitlab.aicrowd.com:aicrowd/practice-challenges/aicrowd_CRDIO_challenge_evaluator.git
data_url
:
https://s3.wasabisys.com/aicrowd-practice-challenges/public/crdio/v0.1/test_ground_truth.csv
official_baseline
:
CRDIO_baseline.ipynb
...
...
utils.py
0 → 100644
View file @
516999a8
import
requests
import
html
import
markdown
import
yaml
import
os
class
Utils
():
def
__init__
(
self
):
self
.
base_url
=
"https://www.aicrowd.com/api/v1/challenges"
self
.
api_key
=
os
.
getenv
(
"AICROWD_API_KEY"
)
self
.
headers
=
{
'Authorization'
:
'Token token="'
+
self
.
api_key
+
'"'
,
'Content-Type'
:
'application/json'
}
with
open
(
"aicrowd.yaml"
,
"r"
)
as
f
:
self
.
challenge
=
yaml
.
safe_load
(
f
)[
'challenge_name'
]
print
(
self
.
challenge
)
with
open
(
"README.md"
,
"r"
)
as
f
:
self
.
content
=
f
.
read
()
self
.
convert
()
def
convert
(
self
):
self
.
content
=
markdown
.
markdown
(
self
.
content
)
self
.
content
=
self
.
content
.
replace
(
"
\"
"
,
"'"
)
self
.
content
=
self
.
content
.
replace
(
"h1"
,
"h2"
)
html
.
unescape
(
self
.
content
)
def
create_challenge
(
self
):
payload
=
{
"challenge"
:
self
.
challenge
.
upper
(),
"status_cd"
:
"draft"
,
"tagline"
:
""
,
"perpetual_challenge"
:
False
,
"answer_file_s3_key"
:
None
,
"slug"
:
self
.
challenge
,
"submission_license"
:
""
,
"api_required"
:
False
,
"media_on_leaderboard"
:
False
,
"online_grading"
:
True
,
"description"
:
self
.
content
,
"evaluation"
:
None
,
"rules"
:
None
,
"prizes"
:
None
,
"resources"
:
None
,
"submission_instructions"
:
None
,
"subissions_page"
:
True
,
"license"
:
""
,
"dataset_description"
:
None
,
"image_file"
:
{
"url"
:
f
"https://gitlab.aicrowd.com/aicrowd/practice-challenges/aicrowd_
{
self
.
challenge
.
upper
()
}
_challenge/
{
self
.
challenge
.
upper
()
}
.jpg"
},
"show_leaderboard"
:
True
,
"grader_identifier"
:
"AIcrowd_GRADER_POOL"
,
"online_submissions"
:
True
,
"grader_logs"
:
False
,
"require_registration"
:
False
,
"grading_history"
:
False
,
"post_challenge_submissions"
:
False
,
"submissions_downloadable"
:
False
,
"dataset_note"
:
None
,
"discussions_visible"
:
True
,
"latest_submission"
:
False
,
"other_scores_fieldnames"
:
""
,
"teams_allowed"
:
True
,
"max_team_participants"
:
5
,
"team_freeze_seconds_before_end"
:
604800
,
"hidden_challenge"
:
False
,
"team_freeze_time"
:
None
,
"score_title"
:
""
,
"score_secondary_title"
:
""
,
"primary_sort_order_cd"
:
""
,
"secondary_sort_order_cd"
:
""
,
"challenges_organizers_attributes"
:
[{
"organizer_id"
:
9
,
"challenge_id"
:
1
}],
"category_challenges_attributes"
:
[{
"category_id"
:
"8"
}],
"dataset_files_attributes"
:
[
{
"seq"
:
1
,
"title"
:
"train.csv"
,
"description"
:
"File that should be used for training. It contains the data with their respective labels"
,
"evaluation"
:
False
,
"visible"
:
True
,
"hosting_location"
:
"External"
,
"external_url"
:
f
"https://s3.eu-central-1.wasabisys.com/aicrowd-practice-challenges/public/
{
self
.
challenge
}
/v0.1/train.csv"
,
"external_file_size"
:
""
},
{
"seq"
:
2
,
"title"
:
"test.csv"
,
"description"
:
"File that should be used for testing. It does not contains the labels"
,
"evaluation"
:
False
,
"visible"
:
True
,
"hosting_location"
:
"External"
,
"external_url"
:
f
"https://s3.eu-central-1.wasabisys.com/aicrowd-practice-challenges/public/
{
self
.
challenge
}
/v0.1/test.csv"
,
"external_file_size"
:
""
},
]
}
return
requests
.
post
(
self
.
base_url
,
json
=
payload
,
headers
=
self
.
headers
)
def
update_challenge
(
self
):
payload
=
{
"description"
:
self
.
content
}
request_url
=
f
"
{
self
.
base_url
}
/
{
self
.
challenge
}
"
return
requests
.
patch
(
request_url
,
json
=
payload
,
headers
=
self
.
headers
)
def
update_or_create
(
self
):
response
=
self
.
update_challenge
()
if
response
.
status_code
==
404
:
response
=
self
.
create_challenge
()
return
response
if
__name__
==
"__main__"
:
utils
=
Utils
()
print
(
utils
.
update_or_create
().
text
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment