citradiani commited on
Commit
5b1310d
·
verified ·
1 Parent(s): d3a32bd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -6,6 +6,8 @@ import torch.nn as nn
6
  import pandas as pd
7
  import numpy as np
8
  import gradio as gr
 
 
9
 
10
  class_names = ['apple_pie',
11
  'bibimbap',
@@ -41,7 +43,8 @@ def predict(img_path):
41
  # Apply transformations
42
  image = test_transforms(image)
43
 
44
- inf_model = models.resnet18(pretrained=False)
 
45
  num_ftrs = inf_model.fc.in_features
46
  # Here the size of each output sample is set to 2.
47
  # Alternatively, it can be generalized to nn.Linear(num_ftrs, len(class_names)).
 
6
  import pandas as pd
7
  import numpy as np
8
  import gradio as gr
9
+ import warnings
10
+ warnings.filterwarnings("ignore", category=UserWarning)
11
 
12
  class_names = ['apple_pie',
13
  'bibimbap',
 
43
  # Apply transformations
44
  image = test_transforms(image)
45
 
46
+ inf_model = models.resnet18(pretrained=False, weights='ResNet50_Weights.DEFAULT')
47
+
48
  num_ftrs = inf_model.fc.in_features
49
  # Here the size of each output sample is set to 2.
50
  # Alternatively, it can be generalized to nn.Linear(num_ftrs, len(class_names)).