Skip to content

Commit 6d498b3

Browse files
authored
samples comment update
1 parent 5e9a6bb commit 6d498b3

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

samples/job_with_aws_input_sample.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
sys.path.insert(0, '..')
1010
from modzy import ApiClient
1111

12-
12+
1313
# Always configure the logger level (ie: DEBUG, INFO, WARNING, ERROR, CRITICAL)
1414
logging.basicConfig(level=logging.INFO)
1515
logger = logging.getLogger(__name__)
1616

1717
# The system admin can provide the right base API URL, the API key can be downloaded from your profile page on Modzy.
18-
# You can configure those params as is described in the README file (as environment variables, or by using the .env file),
18+
# You can configure those params as described in the README file (as environment variables, or by using the .env file),
1919
# or you can just update the BASE_URL and API_KEY variables and use this sample code (not recommended for production environments).
2020

2121
dotenv.load_dotenv()
@@ -35,8 +35,8 @@
3535
# Create a Job with an aws input, wait, and retrieve results:
3636

3737
# Get the model object:
38-
# If you already know the model identifier (i.e.: you got from the URL of the model details page or the input sample),
39-
# you can skip this step. If you don't you can find the model identifier by using its name as follows:
38+
# If you already know the model identifier (i.e.: you got it from the URL of the model details page or the input sample),
39+
# you can skip this step. If you don't, you can find the model identifier by using its name as follows:
4040
model = client.models.get_by_name("Facial Embedding")
4141
# Or if you already know the model id and want to know more about the model, you can use this instead:
4242
# model = client.models.get("f7e252e26a")
@@ -49,10 +49,10 @@
4949

5050
# Get the model version object:
5151
# If you already know the model version and the input key(s) of the model version you can skip this step. Also, you can
52-
# use the following code block to know about the inputs keys and skip the call on future job submissions.
52+
# use the following code block to know about the input keys and skip the call on future job submissions.
5353
modelVersion = client.models.get_version(model, model.latest_version)
5454
# The info stored in modelVersion provides insights about the amount of time that the model can spend processing,
55-
# the inputs, and output keys of the model.
55+
# the input, and output keys of the model.
5656
logger.info("This model version is {}".format(modelVersion))
5757
logger.info(" timeouts: status {}ms, run {}ms ".format(modelVersion.timeout.status, modelVersion.timeout.run))
5858
logger.info(" inputs: ")
@@ -75,11 +75,11 @@
7575
BUCKET_NAME="<<BucketName>>"
7676
# The File Key: replace <<FileId>> (remember, this model needs an image as input)
7777
FILE_KEY="<<FileId>>"
78-
# With the info about the model (identifier), the model version (version string, input/output keys), you are ready to
78+
# With the info about the model (identifier) and the model version (version string, input/output keys), you are ready to
7979
# submit the job. Just prepare the source dictionary:
8080
sources = {"source-key": {"image": {'bucket': BUCKET_NAME, 'key': FILE_KEY}}}
81-
# An inference job groups input data that you send to a model. You can send any amount of inputs to
82-
# process and you can identify and refer to a specific input by the key that you assign, for example we can add:
81+
# An inference job groups input data sent to a model. You can send any amount of inputs to
82+
# process and you can identify and refer to a specific input by the key assigned. For example we can add:
8383
sources["second-key"] = {"image": {'bucket': BUCKET_NAME, 'key': FILE_KEY}}
8484
sources["another-key"] = {"image": {'bucket': BUCKET_NAME, 'key': FILE_KEY}}
8585
# If you send a wrong input key, the model fails to process the input.
@@ -93,7 +93,7 @@
9393
logger.info("job: %s", job)
9494
# The job moves to SUBMITTED, meaning that Modzy acknowledged the job and sent it to the queue to be processed.
9595
# We provide a helper method to listen until the job finishes processing. Its a good practice to set a max timeout
96-
# if you're doing a test (ie: 2*status+run). Otherwise, if the timeout is set to None, it will listen until the job
96+
# if you're doing a test (ie: 2*status+run). Otherwise, if the timeout is set to None, it listens until the job
9797
# finishes and moves to COMPLETED, CANCELED, or TIMEOUT.
9898
job.block_until_complete(timeout=None)
9999

@@ -103,12 +103,12 @@
103103
# A completed job means that all the inputs were processed by the model. Check the results for each
104104
# input key provided in the source dictionary to see the model output.
105105
result = job.get_result()
106-
# The result object has some useful info:
106+
# The results object has some useful info:
107107
logger.info("Result: finished: {}, total: {}, completed: {}, failed: {}"
108108
.format(result.finished, result.total, result.completed, result.failed))
109109
# Notice that we are iterating through the same input source keys
110110
for key in sources:
111-
# The result object has the individual results of each job input. In this case the output key is called
111+
# The results object has the individual results of each job input. In this case the output key is called
112112
# results.json, so we can get the results as follows:
113113
try:
114114
model_res = result.get_source_outputs(key)['results.json']

0 commit comments

Comments
 (0)