Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JannikSchneider12 committed Oct 28, 2024
1 parent efab878 commit cda75ba
Showing 1 changed file with 45 additions and 2 deletions.
47 changes: 45 additions & 2 deletions remote_challenge_evaluation/main.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,61 @@
import json
import os
import time
from pathlib import Path
import sys

import requests

from eval_ai_interface import EvalAI_Interface
from evaluate import evaluate



#############################################################################
def load_config(file_path='github/host_config.json'):
try:
with open(file_path, 'r') as f:
return json.load(f)
except FileNotFoundError:
print(f"Error: {file_path} not found.")
sys.exit(1)
except json.JSONDecodeError:
print(f"Error: {file_path} is not a valid JSON file.")
sys.exit(1)

# Load configuration from JSON file
config = load_config()


# Define mapping between config file keys and required variable names
config_mapping = {
"token": "AUTH_TOKEN",
"evalai_host_url": "API_SERVER",

"queue_name": "QUEUE_NAME",
"challenge_pk": "CHALLENGE_PK",
"save_dir": "SAVE_DIR"
}

# Set environment variables from config
for config_key, env_var in config_mapping.items():
if config_key in config:
os.environ[env_var] = str(config[config_key])
# elif env_var != "SAVE_DIR": # SAVE_DIR is optional
# print(f"Error: {config_key} is not set in the config file.")
# sys.exit(1)
# Set default for SAVE_DIR if not in config
if "SAVE_DIR" not in os.environ:
os.environ["SAVE_DIR"] = "./"

#############################################################################

# Remote Evaluation Meta Data
# See https://evalai.readthedocs.io/en/latest/evaluation_scripts.html#writing-remote-evaluation-script
auth_token = os.environ["AUTH_TOKEN"]
evalai_api_server = os.environ["API_SERVER"]
queue_name = os.environ["QUEUE_NAME"]
challenge_pk = os.environ["CHALLENGE_PK"]
queue_name = "embed2scale-challenge-test2--2389-production-c43a1f6e-35a3-4e13-b1ef-14f7fa771e6"
challenge_pk = "2389" #os.environ["CHALLENGE_PK"]
save_dir = os.environ.get("SAVE_DIR", "./")


Expand Down

0 comments on commit cda75ba

Please sign in to comment.