Приглашение становится неудачным в Azure Computer Vision, когда учетная запись хранения является частной [закрыто]Python

Программы на Python
Ответить Пред. темаСлед. тема
Anonymous
 Приглашение становится неудачным в Azure Computer Vision, когда учетная запись хранения является частной [закрыто]

Сообщение Anonymous »

В настоящее время сталкиваюсь с проблемой с доступом к учетной записи во время приема данных с использованием компьютерного зрения. Проблема возникает, когда учетная запись хранения установлена ​​на частную. Однако, когда учетная запись хранения является общедоступной, процесс приема проглатывания успешно завершается. Поглаживание данных в частную учетную запись хранения
Фактический результат: проглатывание работает только тогда, когда учетная запись хранилища установлена ​​на публику. .
Я использовал ниже как ссылку для разработки моего кода
https://learn.microsoft.com/en-us/azure/ai- Сервисы/компьютерное висион/ссылочный video-search
Пожалуйста, найдите код для ссылки, дайте мне знать, если какие-либо предложения для кода ниже.
def add_video_to_index(vision_api_endpoint: str, vision_api_key: str, index_name: str, video_url: str, video_id: str,
ingestion_name: str) -> object:
"""Function to add a Video to the Retrieval Index created in the Computer Vision API.

Args:
vision_api_endpoint (str): URL Endpoint for the Computer Vision API service
vision_api_key (str): Key to access the Vision API service
index_name (str): Name to be provided to the created index
video_url (str): SAS URL from the Blob storage account for the video
video_id (str): ID of the Video Docoument being added to the index
ingestion_name (str): Name with whcich the ingestion needs to be created

Returns:
Response: Returns a response object after a put call to the Indexes endpoint of th Vision API retrieval service
"""
# Setup the Computer Vision Video Indexing service URL
url = (
f"{vision_api_endpoint}/computervision/retrieval/indexes/{index_name}"
f"/ingestions/{ingestion_name}?api-version=2023-05-01-preview"#2024-10-01 #2023-05-01-preview
)
headers = {"Ocp-Apim-Subscription-Key": vision_api_key, "Content-Type": "application/json"}

# Setup data in add mode
data = {
"videos": [{"mode": "add", "documentId": video_id, "documentUrl": video_url}],
"generateInsightIntervals": False,
"moderation": False,
"filterDefectedFrames": False,
# "includeSpeechTranscrpt": True,
}

# Return a response from the URL request
return requests.put(url, headers=headers, data=json.dumps(data), timeout=600)

def wait_for_ingestion_completion(vision_api_endpoint: str, vision_api_key: str, index_name: str, ingestion_name: str, max_retries: int = 30) -> bool:
"""Function to wait for CV Indxing Ingestion request to complete

Args:
vision_api_endpoint (str): API Endpoint for the Computer Vision service from the Azure AI Services suite
vision_api_key (str): API key for Computer Vision service
index_name (str): Video Index name to which thev ingestion request was created
max_retries (int): No of attempts to be made before exiting the status check

Returns:
bool: Returns True of False based on the success or failure of the ingestion to the Computer Vision Indexing API
"""
# Setup the Computer Vision Video Indexing service URL
url = (
f"{vision_api_endpoint}/computervision/retrieval/indexes/{index_name}/ingestions/{ingestion_name}?api-version=2023-05-01-preview" #2024-10-01"
)
headers = {"Ocp-Apim-Subscription-Key": vision_api_key}

# Start the status check loop
retries = 0
while retries < max_retries:
response = requests.get(url, headers=headers)
state_data = response.json()
print(state_data)
# Return or continue based on status
if response.status_code == 200:
if "value" in state_data.keys():
if state_data["value"][0]["state"] == "Completed":
print("Ingestion completed.")
return True
if state_data["value"][0]["state"] == "Failed":
print("Ingestion failed.")
return False
else:
if state_data["state"] == "Completed":
print("Ingestion completed.")
return True
if state_data["state"] == "Failed":
print("Ingestion failed.")
return False
time.sleep(60) #60 sec wait between respective checks
retries += 1


Подробнее здесь: https://stackoverflow.com/questions/793 ... unt-is-pri
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «Python»