File size: 654 Bytes
c899fa2
3442849
fd3835f
7d1537c
 
 
 
fd3835f
 
7d1537c
fd3835f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import requests
import os
import gradio as gr

API_URL = "https://api-inference.huggingface.co/models/facebook/detr-resnet-50-panoptic"
headers = {"Authorization": "Bearer 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"}

def image_classifier(inp):
    return {'cat': 0.3, 'dog': 0.7}

demo = gr.Interface(fn=image_classifier, inputs="image", outputs="label")
demo.launch()



# def query(filename):
#     with open(filename, "rb") as f:
#         data = f.read()
#     response = requests.post(API_URL, headers=headers, data=data)
#     return response.json()

# # train = os.listdir("./")
# # print(train)
# output = query("./09_truck.jpg")
# print(output)