Maria-Dolgaya commited on
Commit
7ab069e
1 Parent(s): 92b7f6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -5,11 +5,11 @@ from torchvision.models import resnet18, ResNet18_Weights
5
  from torch import nn
6
  from PIL import Image # pip install pillow
7
 
8
- labels = ['Fractured','Non-fractured']
9
 
10
  # Same data transformation that was used for inputs (except data augmentation)
11
  data_transform = transforms.Compose([
12
- transforms.Resize(size=(256, 256)),
13
  transforms.ToTensor(),
14
  transforms.Normalize(mean=[0.485, 0.456, 0.406],
15
  std=[0.229, 0.224, 0.225])
@@ -30,14 +30,14 @@ def predict(img):
30
  confidences = {labels[i]: float(predictions[i]) for i in range(len(labels))}
31
  return confidences
32
 
33
- title = "Corn Leaf Diseases"
34
- description = "A corn leaf disease classifier trained on the Kaggle dataset using Resnet18"
35
 
36
  demo=gr.Interface(fn=predict,
37
  inputs=gr.Image(type="pil"),
38
  outputs=gr.Label(num_top_classes=len(labels)),
39
  title=title,
40
  description=description,
41
- examples=["2.jpg", "Corn_Common_Rust.jpg"])
42
 
43
  demo.launch('share=True')
 
5
  from torch import nn
6
  from PIL import Image # pip install pillow
7
 
8
+ labels = ['fractured','not fractured']
9
 
10
  # Same data transformation that was used for inputs (except data augmentation)
11
  data_transform = transforms.Compose([
12
+ transforms.Resize(size=(128, 128)),
13
  transforms.ToTensor(),
14
  transforms.Normalize(mean=[0.485, 0.456, 0.406],
15
  std=[0.229, 0.224, 0.225])
 
30
  confidences = {labels[i]: float(predictions[i]) for i in range(len(labels))}
31
  return confidences
32
 
33
+ title = "Bone Fractures"
34
+ description = "Bone fractures classifier trained on the Kaggle dataset using Resnet18"
35
 
36
  demo=gr.Interface(fn=predict,
37
  inputs=gr.Image(type="pil"),
38
  outputs=gr.Label(num_top_classes=len(labels)),
39
  title=title,
40
  description=description,
41
+ examples=["2.jpg", "6.jpg"])
42
 
43
  demo.launch('share=True')