Unable to Access Flask API External Network on Azure Machine Learning Compute Instance

HSIANGYU.LIN 林相宇 0 Reputation points
2024-09-13T03:02:37.2466667+00:00

I created a Compute instance in Machine Learning Studio and generated a public IP. Then, I created a service in a NOTEBOOK using the following code:

from flask import Flask, jsonify

@app.route('/test', methods=['GET'])

def test_api():

 return jsonify({'message': 'API is working!'})

if name == 'main':

 app.run(host='0.0.0.0', port=5000)

However, I cannot ping this IP from an external network. How can I access the API running on port 5000? Thank you.

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
3,332 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.