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