Spaces:
Runtime error
Runtime error
Update app.py
Browse filesreverted all changes
app.py
CHANGED
|
@@ -1,51 +1,15 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import os
|
| 3 |
-
import requests
|
| 4 |
-
from dir import videoIndexer
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
subscription_key = "c54eec632ae5413e8075e3f825727822"
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
{
|
| 16 |
-
'fieldName': 'cameraId',
|
| 17 |
-
'values': ['camera1']
|
| 18 |
-
}
|
| 19 |
-
],
|
| 20 |
-
'featureFilters': ['vision']
|
| 21 |
-
}
|
| 22 |
-
headers = {
|
| 23 |
-
"Ocp-Apim-Subscription-Key": subscription_key,
|
| 24 |
-
"Content-Type": "application/json"
|
| 25 |
-
}
|
| 26 |
-
data = {
|
| 27 |
-
'queryText': query_text,
|
| 28 |
-
'filters': filters
|
| 29 |
-
}
|
| 30 |
-
response = requests.post(endpoint_url, headers=headers, json=data)
|
| 31 |
-
|
| 32 |
-
# Process the response
|
| 33 |
-
if response.status_code == 200:
|
| 34 |
-
result = response.json() # Extract the result from the JSON response
|
| 35 |
-
# Process the result here, you can modify this based on your requirements
|
| 36 |
-
return result
|
| 37 |
-
else:
|
| 38 |
-
print("Failed to query video index. Status code:", response.status_code)
|
| 39 |
-
print("Error message:", response.text)
|
| 40 |
-
return None
|
| 41 |
-
|
| 42 |
-
demo = gr.Interface(video_identity,
|
| 43 |
-
gr.Video(),
|
| 44 |
-
"playable_video",
|
| 45 |
-
examples=[
|
| 46 |
-
os.path.join(os.path.dirname(__file__),
|
| 47 |
-
"video/test_video.mp4")],
|
| 48 |
cache_examples=True)
|
| 49 |
|
| 50 |
-
if __name__ == "__main__":
|
| 51 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import os
|
|
|
|
|
|
|
| 3 |
|
| 4 |
+
def video_identity(video):
|
| 5 |
+
return video
|
|
|
|
| 6 |
|
| 7 |
+
demo = gr.Interface(video_identity,
|
| 8 |
+
gr.Video(),
|
| 9 |
+
"playable_video",
|
| 10 |
+
examples=[os.path.join(os.path.dirname(__file__),
|
| 11 |
+
"video/test_video.mp4")],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
cache_examples=True)
|
| 13 |
|
| 14 |
+
if __name__ == "__main__":
|
| 15 |
demo.launch()
|