anon5 commited on
Commit
c163082
1 Parent(s): c55b8a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -25,7 +25,7 @@ def hello_world():
25
  url = request.args.get('url')
26
 
27
  if url is None:
28
- return jsonify(error="Url is required", url=None, classes=[])
29
 
30
  image = Image.open(requests.get(url, stream=True).raw)
31
 
@@ -36,4 +36,4 @@ def hello_world():
36
  # model predicts one of the 1000 ImageNet classes
37
  predicted_class_idx = logits.argmax(-1).item()
38
 
39
- return jsonify(url=url, classes=model.config.id2label[predicted_class_idx])
 
25
  url = request.args.get('url')
26
 
27
  if url is None:
28
+ return jsonify(error="Url is required", url=None, class=None)
29
 
30
  image = Image.open(requests.get(url, stream=True).raw)
31
 
 
36
  # model predicts one of the 1000 ImageNet classes
37
  predicted_class_idx = logits.argmax(-1).item()
38
 
39
+ return jsonify(url=url, class=model.config.id2label[predicted_class_idx])