fohy24 commited on
Commit
3f3c078
·
1 Parent(s): d19bb0a

added basic gradio interface

Browse files
Files changed (1) hide show
  1. app.py +6 -9
app.py CHANGED
@@ -1,10 +1,4 @@
1
- import gradio as gr
2
-
3
- import pandas as pd
4
- import numpy as np
5
-
6
  import torch
7
- # from torch.utils.data import Dataset, DataLoader, Subset
8
  from torch import nn
9
  from torchvision import models
10
  import torch.nn.functional as F
@@ -12,9 +6,6 @@ from torchvision.transforms import v2
12
 
13
  from PIL import Image
14
 
15
- # from PIL import ImageFile
16
- # ImageFile.LOAD_TRUNCATED_IMAGES = True
17
-
18
  labels = ['Pastel',
19
  'Yellow Belly',
20
  'Enchi',
@@ -79,5 +70,11 @@ def predict(img):
79
 
80
  return prediction_dict
81
 
 
82
 
 
 
 
 
 
83
 
 
 
 
 
 
 
1
  import torch
 
2
  from torch import nn
3
  from torchvision import models
4
  import torch.nn.functional as F
 
6
 
7
  from PIL import Image
8
 
 
 
 
9
  labels = ['Pastel',
10
  'Yellow Belly',
11
  'Enchi',
 
70
 
71
  return prediction_dict
72
 
73
+ import gradio as gr
74
 
75
+ gr.Interface(fn=predict,
76
+ inputs=gr.Image(type="pil"),
77
+ outputs=gr.Label(),
78
+ examples=["pastel_yb.jpg", "piebald.jpg", "leopard_fire.png"]
79
+ ).launch()
80