Spaces:
Runtime error
Runtime error
Delete videoIndexer.py
Browse files- videoIndexer.py +0 -51
videoIndexer.py
DELETED
|
@@ -1,51 +0,0 @@
|
|
| 1 |
-
import requests
|
| 2 |
-
|
| 3 |
-
# Define your endpoint URL and subscription key
|
| 4 |
-
endpoint_url = "https://explosion.cognitiveservices.azure.com/computervision/retrieval/indexes?api-version=2023-05-01-preview"
|
| 5 |
-
subscription_key = "c54eec632ae5413e8075e3f825727822"
|
| 6 |
-
|
| 7 |
-
# Define the request headers
|
| 8 |
-
headers = {
|
| 9 |
-
"Ocp-Apim-Subscription-Key": subscription_key,
|
| 10 |
-
"Content-Type": "application/json"
|
| 11 |
-
}
|
| 12 |
-
|
| 13 |
-
# Define the request body for creating the video index
|
| 14 |
-
body = {
|
| 15 |
-
"name": "my-video-index",
|
| 16 |
-
"metadataSchema": {
|
| 17 |
-
"fields": [
|
| 18 |
-
{
|
| 19 |
-
"name": "cameraId",
|
| 20 |
-
"searchable": False,
|
| 21 |
-
"filterable": True,
|
| 22 |
-
"type": "string"
|
| 23 |
-
},
|
| 24 |
-
{
|
| 25 |
-
"name": "timestamp",
|
| 26 |
-
"searchable": False,
|
| 27 |
-
"filterable": True,
|
| 28 |
-
"type": "datetime"
|
| 29 |
-
}
|
| 30 |
-
]
|
| 31 |
-
},
|
| 32 |
-
"features": [
|
| 33 |
-
{
|
| 34 |
-
"name": "vision",
|
| 35 |
-
"domain": "surveillance"
|
| 36 |
-
},
|
| 37 |
-
{
|
| 38 |
-
"name": "speech"
|
| 39 |
-
}
|
| 40 |
-
]
|
| 41 |
-
}
|
| 42 |
-
|
| 43 |
-
# Send the request to create the video index
|
| 44 |
-
response = requests.put(endpoint_url, headers=headers, json=body)
|
| 45 |
-
|
| 46 |
-
# Check if the request was successful
|
| 47 |
-
if response.status_code == 200:
|
| 48 |
-
print("Video index created successfully.")
|
| 49 |
-
else:
|
| 50 |
-
print("Failed to create video index. Status code:", response.status_code)
|
| 51 |
-
print("Error message:", response.text)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|