setsosie commited on
Commit
fabaf4d
·
verified ·
1 Parent(s): 084ddd1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -6
app.py CHANGED
@@ -25,14 +25,10 @@ def predict(img):
25
  confidences: python dictionary containing confidences
26
  '''
27
  # Transform image to pytorch tensor of shape [1, 3, 224, 224]
28
- print(type(img))
29
  img = T.PILToTensor()(img).unsqueeze(0)
30
- print(img.dtype)
31
- print(type(img))
32
  img = T.Resize(size=(224, 224))(img)
33
  img = img / 255
34
- print(type(img))
35
- print(img.dtype)
36
 
37
  # Use model without gradients to reduce computation
38
  with torch.no_grad():
@@ -48,4 +44,4 @@ gr.Interface(fn=predict,
48
  inputs=gr.Image(type="pil"),
49
  outputs=gr.Label(num_top_classes=10),
50
  theme="default",
51
- ).launch(share=True)
 
25
  confidences: python dictionary containing confidences
26
  '''
27
  # Transform image to pytorch tensor of shape [1, 3, 224, 224]
28
+ # Put your image transforms here
29
  img = T.PILToTensor()(img).unsqueeze(0)
 
 
30
  img = T.Resize(size=(224, 224))(img)
31
  img = img / 255
 
 
32
 
33
  # Use model without gradients to reduce computation
34
  with torch.no_grad():
 
44
  inputs=gr.Image(type="pil"),
45
  outputs=gr.Label(num_top_classes=10),
46
  theme="default",
47
+ ).launch(share=False)