oliver9523 commited on
Commit
35124ac
·
1 Parent(s): 89a0702

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +12 -12
main.py CHANGED
@@ -1,14 +1,14 @@
1
  import gradio as gr
2
- import torch
3
- import requests
4
- from torchvision import transforms
5
  import cv2
6
  from geti_sdk.deployment import Deployment
7
  from geti_sdk.utils import show_image_with_annotation_scene
8
 
9
- model = torch.hub.load("pytorch/vision:v0.6.0", "resnet18", pretrained=True).eval()
10
- response = requests.get("https://git.io/JJkYN")
11
- labels = response.text.split("\n")
12
 
13
 
14
  # Step 1: Load the deployment
@@ -37,12 +37,12 @@ def infer(image=None):
37
  return [output, prediction.overview]
38
 
39
 
40
- def predict(inp):
41
- inp = transforms.ToTensor()(inp).unsqueeze(0)
42
- with torch.no_grad():
43
- prediction = torch.nn.functional.softmax(model(inp)[0], dim=0)
44
- confidences = {labels[i]: float(prediction[i]) for i in range(1000)}
45
- return confidences
46
 
47
 
48
  def run():
 
1
  import gradio as gr
2
+ # import torch
3
+ # import requests
4
+ # from torchvision import transforms
5
  import cv2
6
  from geti_sdk.deployment import Deployment
7
  from geti_sdk.utils import show_image_with_annotation_scene
8
 
9
+ # model = torch.hub.load("pytorch/vision:v0.6.0", "resnet18", pretrained=True).eval()
10
+ # response = requests.get("https://git.io/JJkYN")
11
+ # labels = response.text.split("\n")
12
 
13
 
14
  # Step 1: Load the deployment
 
37
  return [output, prediction.overview]
38
 
39
 
40
+ # def predict(inp):
41
+ # inp = transforms.ToTensor()(inp).unsqueeze(0)
42
+ # with torch.no_grad():
43
+ # prediction = torch.nn.functional.softmax(model(inp)[0], dim=0)
44
+ # confidences = {labels[i]: float(prediction[i]) for i in range(1000)}
45
+ # return confidences
46
 
47
 
48
  def run():