diff --git a/allocmd/templates/Dockerfile.j2 b/allocmd/templates/Dockerfile.j2 index 3c544fc..76e4d18 100644 --- a/allocmd/templates/Dockerfile.j2 +++ b/allocmd/templates/Dockerfile.j2 @@ -1,4 +1,4 @@ -FROM --platform=linux/amd64 alloranetwork/allora-inference-base:latest +FROM alloranetwork/allora-inference-base:latest COPY requirements.txt /app/ RUN pip3 install --requirement /app/requirements.txt diff --git a/allocmd/templates/main.py.j2 b/allocmd/templates/main.py.j2 index 5d11e84..45bdc18 100644 --- a/allocmd/templates/main.py.j2 +++ b/allocmd/templates/main.py.j2 @@ -2,18 +2,27 @@ import requests import sys import json -# modify the main function as necessary -def main(argument): +# modify the process function as necessary +def process(argument): url = f"https://upshot.com/inference/{argument}" response = requests.get(url) - print(response) + return response.text if __name__ == "__main__": + # Your code logic with the parsed argument goes here try: - topic_id = sys.argv[1] - inference_argument = sys.argv[2] - # main(inference_argument) # uncomment this after modification - print('{"value":"1000.0"}') # remove this after modiciation + if len(sys.argv) < 5: + value = json.dumps({"error": f"Not enough arguments provided: {len(sys.argv)}, expected 4 arguments: topic_id, blockHeight, blockHeightEval, default_arg"}) + else: + topic_id = sys.argv[1] + blockHeight = sys.argv[2] + blockHeightEval = sys.argv[3] + default_arg = sys.argv[4] + + # response_inference = process(argument=default_arg) # uncomment this after modification + response_inference = "1000.0" # remove this after modification + response_dict = {"infererValue": response_inference} + value = json.dumps(response_dict) except Exception as e: - response = json.dumps({"error": {str(e)}}) - print(response) + value = json.dumps({"error": {str(e)}}) + print(value) diff --git a/allocmd/utilities/constants.py b/allocmd/utilities/constants.py index a285288..a810dd1 100644 --- a/allocmd/utilities/constants.py +++ b/allocmd/utilities/constants.py @@ -1 +1 @@ -cliVersion = "2.0.1" +cliVersion = "2.0.2"