akhaliq HF staff commited on
Commit
edc5eaa
1 Parent(s): 362d9ea

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
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)