Commit
·
7d1537c
1
Parent(s):
c899fa2
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,12 @@
|
|
1 |
-
import json
|
2 |
import requests
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
data =
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import requests
|
2 |
+
|
3 |
+
API_URL = "https://api-inference.huggingface.co/models/facebook/detr-resnet-50-panoptic"
|
4 |
+
headers = {"Authorization": "Bearer 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"}
|
5 |
+
|
6 |
+
def query(filename):
|
7 |
+
with open(filename, "rb") as f:
|
8 |
+
data = f.read()
|
9 |
+
response = requests.post(API_URL, headers=headers, data=data)
|
10 |
+
return response.json()
|
11 |
+
|
12 |
+
output = query("cats.jpg")
|