Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
Fix main.py to be v2 compatible (#6)
Browse files Browse the repository at this point in the history
* Fix main.py template to be v2 compatible

* Remove platform flag

* Increment version
  • Loading branch information
clementupshot authored Jun 18, 2024
1 parent 91cdc65 commit 9e93868
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion allocmd/templates/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -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
Expand Down
27 changes: 18 additions & 9 deletions allocmd/templates/main.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion allocmd/utilities/constants.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cliVersion = "2.0.1"
cliVersion = "2.0.2"

0 comments on commit 9e93868

Please sign in to comment.