yuragoithf
commited on
Commit
•
fd3835f
1
Parent(s):
dc23e54
Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,25 @@
|
|
1 |
import requests
|
2 |
import os
|
|
|
3 |
|
4 |
API_URL = "https://api-inference.huggingface.co/models/facebook/detr-resnet-50-panoptic"
|
5 |
headers = {"Authorization": "Bearer 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"}
|
6 |
|
7 |
-
def
|
8 |
-
|
9 |
-
data = f.read()
|
10 |
-
response = requests.post(API_URL, headers=headers, data=data)
|
11 |
-
return response.json()
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import requests
|
2 |
import os
|
3 |
+
import gradio as gr
|
4 |
|
5 |
API_URL = "https://api-inference.huggingface.co/models/facebook/detr-resnet-50-panoptic"
|
6 |
headers = {"Authorization": "Bearer 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"}
|
7 |
|
8 |
+
def image_classifier(inp):
|
9 |
+
return {'cat': 0.3, 'dog': 0.7}
|
|
|
|
|
|
|
10 |
|
11 |
+
demo = gr.Interface(fn=image_classifier, inputs="image", outputs="label")
|
12 |
+
demo.launch()
|
13 |
+
|
14 |
+
|
15 |
+
|
16 |
+
# def query(filename):
|
17 |
+
# with open(filename, "rb") as f:
|
18 |
+
# data = f.read()
|
19 |
+
# response = requests.post(API_URL, headers=headers, data=data)
|
20 |
+
# return response.json()
|
21 |
+
|
22 |
+
# # train = os.listdir("./")
|
23 |
+
# # print(train)
|
24 |
+
# output = query("./09_truck.jpg")
|
25 |
+
# print(output)
|