Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import paddlehub as hub
|
3 |
+
|
4 |
+
|
5 |
+
model = hub.Module(name='ghostnet_x1_3_imagenet')
|
6 |
+
|
7 |
+
def inference(img):
|
8 |
+
result = model.predict([img])
|
9 |
+
for key, value in result[0].items():
|
10 |
+
result[0][key] = float(value)
|
11 |
+
print(result)
|
12 |
+
return result[0]
|
13 |
+
|
14 |
+
|
15 |
+
title="ghostnet_x1_3_imagenet"
|
16 |
+
description="GhostNet is a new lightweight network structure proposed by Huawei in 2020. By introducing the ghost module, the redundant calculation problem of features in traditional deep networks is greatly alleviated, and the network parameters and calculation amount are greatly reduced."
|
17 |
+
|
18 |
+
examples=[['cat2.jpg']]
|
19 |
+
gr.Interface(inference,gr.inputs.Image(type="filepath"),"label",title=title,description=description,examples=examples).launch(enable_queue=True,cache_examples=True)
|