Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,13 @@ import gradio as gr
|
|
7 |
#os.system("wget https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt")
|
8 |
|
9 |
#model = torch.hub.load('huawei-noah/ghostnet', 'ghostnet_1x', pretrained=True)
|
10 |
-
model = torch.jit.load('https://huggingface.co/spaces/yuhe6/final_project/blob/main/Net_Rotate9.pth').eval().to(device)
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
#torch.hub.download_url_to_file('https://huggingface.co/spaces/yuhe6/final_project/blob/main/Net_Rotate9.pth', '/tmp/temporary_file')
|
12 |
#model = torch.hub.load('/tmp', 'temporary_file', pretrained=True)
|
13 |
|
@@ -48,7 +54,7 @@ def inference(input_image):
|
|
48 |
return result
|
49 |
|
50 |
inputs = gr.inputs.Image(type='pil')
|
51 |
-
outputs = gr.outputs.Label(type="confidences",num_top_classes=
|
52 |
|
53 |
title = "GHOSTNET"
|
54 |
description = "Gradio demo for GHOSTNET, Efficient networks by generating more features from cheap operations. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below."
|
|
|
7 |
#os.system("wget https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt")
|
8 |
|
9 |
#model = torch.hub.load('huawei-noah/ghostnet', 'ghostnet_1x', pretrained=True)
|
10 |
+
#model = torch.jit.load('https://huggingface.co/spaces/yuhe6/final_project/blob/main/Net_Rotate9.pth').eval().to(device)
|
11 |
+
|
12 |
+
|
13 |
+
model = torch.jit.load('Net_Blur_jit.pt', map_location = torch.device('cpu'))
|
14 |
+
model.eval()
|
15 |
+
|
16 |
+
|
17 |
#torch.hub.download_url_to_file('https://huggingface.co/spaces/yuhe6/final_project/blob/main/Net_Rotate9.pth', '/tmp/temporary_file')
|
18 |
#model = torch.hub.load('/tmp', 'temporary_file', pretrained=True)
|
19 |
|
|
|
54 |
return result
|
55 |
|
56 |
inputs = gr.inputs.Image(type='pil')
|
57 |
+
outputs = gr.outputs.Label(type="confidences",num_top_classes=1)
|
58 |
|
59 |
title = "GHOSTNET"
|
60 |
description = "Gradio demo for GHOSTNET, Efficient networks by generating more features from cheap operations. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below."
|