yuragoithf commited on
Commit
e9b5cc1
1 Parent(s): fd3835f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -12
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
- 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)
 
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()