Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Please add more context on the AMLRequest and AMLResponse classes

Aperta
#1,905 0 commenti 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
35/100
Tipo di issue
Documentazione
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
python

Direzione di ricerca

Inizia dalle pagine di riferimento di AMLRequest e AMLResponse e dal file sorgente AzureML-Docset/stable/docs-ref-autogen/azureml.contrib.services.aml_request.AMLRequest.yml; confrontali con l'esempio collegato online-endpoints-binary-payloads.ipynb. Documenta i parametri, gli attributi e l'utilizzo di esempio pertinenti per passare JSON insieme a un file binario e accedervi nello script di scoring.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I am testing the sample https://github.com/Azure/azureml-examples/blob/main/sdk/python/endpoints/online/managed/online-endpoints-binary-payloads.ipynb
As per the documentation, the AMLRequest and AMLResponse classes were inherited from flask.wrappers. However, please also add the parameters and attributes and sample usage of these classes.

If I am sending a JSON object to the MOE (Managed Online Endpoint) along with the binary image file, the request object will hold these values passed as raw httprequest.

payload = {"file-metadata": {
    "filename": "my-image.jpg",
    "file-size": "150kb",
    ...
}}
res = requests.post(
    url=scoring_uri,
    headers={"Authorization": f"Bearer {key}"},
    json=payload, **attempt to pass the payload to the request**
    files=[
        ("file", open("my-image.jpg", "rb"))
    ],
)

How to pass a JSON payload to this request and access that from within the scoring script? I tried to configure the json parameter to assign a sample JSON payload as above sample. However, when viewing the value through req.get_json() in the scoring script, this function returns empty.

@rawhttp
def run(req : AMLRequest):
    print(req.get_json()) **nothing gets printed out**

I found a workaround to assign the payload to the headers parameter as follows. However, it would be appreciated if you may also include the correct approach/sample usage of the above class(es).

payload = {"file-metadata": {
    "filename": "my-image.jpg",
    "file-size": "150kb",
    ...
}}

headers_ = {"Authorization": f"Bearer {key}", "File-Metadata": json.dumps(payload)}

res = requests.post(
    url=scoring_uri,
    headers=headers_
    ...)

Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

Lingua principale
Jupyter Notebook
Stelle
4.4k
Fork
2.6k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Azure/MachineLearningNotebooks

Tutte le issue di Azure/MachineLearningNotebooks

Issue simili

Altre issue su Documentation

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.