ptschandl commited on
Commit
206b8d6
1 Parent(s): 01d73d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -29,7 +29,7 @@ model.to(device=args.get("device"))
29
  torch.set_grad_enabled(False)
30
 
31
 
32
- def predict(image)->dict:
33
  global model, args, normtransform
34
 
35
  prediction_tensor = torch.zeros([1, len(args.get("dxlabels"))]).to(device=args.get("device"))
@@ -40,8 +40,8 @@ def predict(image)->dict:
40
  aug_combos = [x for x in itertools.product(target_sizes, hflips, rotations, crops)]
41
 
42
  # Load image
43
- # img = Image.open(image)
44
- img = image.convert('RGB')
45
 
46
  # Predict with Test-time augmentation
47
  for (target_size, hflip, rotation, crop) in aug_combos:
@@ -73,7 +73,7 @@ If you have a skin change in question, seek contact to your physician.'''
73
 
74
  gr.Interface(
75
  predict,
76
- inputs=gr.Image(label="Upload a dermatoscopic image", type="pil"),
77
  outputs=gr.Label(num_top_classes=len(args.get("dxlabels"))),
78
  title="Dermatoscopic classification",
79
  description=description,
 
29
  torch.set_grad_enabled(False)
30
 
31
 
32
+ def predict(image: str)->dict:
33
  global model, args, normtransform
34
 
35
  prediction_tensor = torch.zeros([1, len(args.get("dxlabels"))]).to(device=args.get("device"))
 
40
  aug_combos = [x for x in itertools.product(target_sizes, hflips, rotations, crops)]
41
 
42
  # Load image
43
+ img = Image.open(image)
44
+ img = img.convert('RGB')
45
 
46
  # Predict with Test-time augmentation
47
  for (target_size, hflip, rotation, crop) in aug_combos:
 
73
 
74
  gr.Interface(
75
  predict,
76
+ inputs=gr.Image(label="Upload a dermatoscopic image", type="filepath"),
77
  outputs=gr.Label(num_top_classes=len(args.get("dxlabels"))),
78
  title="Dermatoscopic classification",
79
  description=description,