yuragoithf commited on
Commit
fd5fbc8
·
1 Parent(s): 92813dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -14,9 +14,9 @@ def query(filename):
14
  data = f.read()
15
  response = requests.post(API_URL, headers=headers, data=data)
16
  return response.json()
17
-
18
- def rb(data):
19
- response = requests.post(API_URL, headers=headers, data=data.tobytes())
20
  return response.json()
21
 
22
  # train = os.listdir("./")
@@ -26,5 +26,5 @@ output = query("./09_truck.jpg")
26
 
27
 
28
  inputs = gr.inputs.Image(type="pil", label="Upload an image")
29
- demo = gr.Interface(fn=rb, inputs=inputs, outputs=output)
30
  demo.launch()
 
14
  data = f.read()
15
  response = requests.post(API_URL, headers=headers, data=data)
16
  return response.json()
17
+ data = bytes(im.getdata())
18
+ def rb(img):
19
+ response = requests.post(API_URL, headers=headers, data=bytes(img.getdata())
20
  return response.json()
21
 
22
  # train = os.listdir("./")
 
26
 
27
 
28
  inputs = gr.inputs.Image(type="pil", label="Upload an image")
29
+ demo = gr.Interface(fn=rb, inputs=inputs, outputs="json")
30
  demo.launch()