awacke1 commited on
Commit
c718335
·
1 Parent(s): 89e5957

Upload 14 files

Browse files
.gitattributes CHANGED
@@ -32,3 +32,8 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
35
+ 20190220_220143.jpg filter=lfs diff=lfs merge=lfs -text
36
+ 20190223_181415.jpg filter=lfs diff=lfs merge=lfs -text
37
+ 20190404_193912.jpg filter=lfs diff=lfs merge=lfs -text
38
+ 20190413_021309.jpg filter=lfs diff=lfs merge=lfs -text
39
+ 20190413_115659.jpg filter=lfs diff=lfs merge=lfs -text
1.jpg ADDED
2.jpg ADDED
20190210_171436.jpg ADDED
20190211_215501.jpg ADDED
20190220_220143.jpg ADDED

Git LFS Details

  • SHA256: f34cc81f2aad9bce43e70018a1521fc347515c4c75c9151e43f75f1e464774f5
  • Pointer size: 132 Bytes
  • Size of remote file: 2.11 MB
20190223_181415.jpg ADDED

Git LFS Details

  • SHA256: 3b46bdc7c285382d9e83e081022b6c9e4072325b01e56cf606a4123135288987
  • Pointer size: 132 Bytes
  • Size of remote file: 2.18 MB
20190404_193912.jpg ADDED

Git LFS Details

  • SHA256: 0a0208eef90d36080bcfcd6498bebf5ca32bd85ecc015c393039ed54faa9e465
  • Pointer size: 132 Bytes
  • Size of remote file: 1.22 MB
20190413_021309.jpg ADDED

Git LFS Details

  • SHA256: ceb287ef8c624be8dc51239af13c573b6300995e21dec865cbe81994e208cc38
  • Pointer size: 132 Bytes
  • Size of remote file: 3.54 MB
20190413_115659.jpg ADDED

Git LFS Details

  • SHA256: 84fff4ff4a64bfeedda58f55f77afcc8b8f11c963f0e7b6ab305657972bacaad
  • Pointer size: 132 Bytes
  • Size of remote file: 6.11 MB
3.jpg ADDED
4.jpg ADDED
5.jpg ADDED
app.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import os
3
+ from PIL import Image
4
+ import torch
5
+ from torchvision import transforms
6
+
7
+ import torch
8
+ model = torch.hub.load('pytorch/vision:v0.10.0', 'wide_resnet50_2', pretrained=True)
9
+ model = torch.hub.load('pytorch/vision:v0.10.0', 'wide_resnet101_2', pretrained=True)
10
+ model.eval()
11
+ os.system("wget https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt")
12
+ torch.hub.download_url_to_file("https://github.com/pytorch/hub/raw/master/images/dog.jpg", "dog.jpg")
13
+
14
+ def inference(input_image):
15
+ preprocess = transforms.Compose([
16
+ transforms.Resize(256),
17
+ transforms.CenterCrop(224),
18
+ transforms.ToTensor(),
19
+ transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
20
+ ])
21
+ input_tensor = preprocess(input_image)
22
+ input_batch = input_tensor.unsqueeze(0) # create a mini-batch as expected by the model
23
+ if torch.cuda.is_available():
24
+ input_batch = input_batch.to('cuda')
25
+ model.to('cuda')
26
+ with torch.no_grad():
27
+ output = model(input_batch)
28
+ probabilities = torch.nn.functional.softmax(output[0], dim=0)
29
+ with open("imagenet_classes.txt", "r") as f:
30
+ categories = [s.strip() for s in f.readlines()]
31
+ top5_prob, top5_catid = torch.topk(probabilities, 5)
32
+ result = {}
33
+ for i in range(top5_prob.size(0)):
34
+ result[categories[top5_catid[i]]] = top5_prob[i].item()
35
+ return result
36
+
37
+ inputs = gr.inputs.Image(type='pil')
38
+ outputs = gr.outputs.Label(type="confidences",num_top_classes=5)
39
+
40
+ title = "WRN - Wide Residual Networks"
41
+ description = "ResNet blocks based architecture where depth is decreased and width of residual networks is increased."
42
+ article = "<p style='text-align: center'><a href='https://paperswithcode.com/paper/wide-residual-networks'>Wide Residual Networks on Papers With Code</a></p>"
43
+ examples = [
44
+ ['1.jpg'],
45
+ ['2.jpg'],
46
+ ['3.jpg'],
47
+ ['4.jpg'],
48
+ ['5.jpg'],
49
+ ]
50
+ gr.Interface(inference, inputs, outputs, title=title, description=description, article=article, examples=examples, analytics_enabled=False).launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ Pillow
2
+ torch
3
+ torchvision