akhaliq HF staff commited on
Commit
2b95fd0
1 Parent(s): 48ac648

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import paddlehub as hub
3
+ import cv2
4
+
5
+
6
+ classifier = hub.Module(name="vgg13_imagenet")
7
+
8
+ def inference(img):
9
+ test_img_path = img
10
+ input_dict = {"image": [test_img_path]}
11
+ result = classifier.classification(data=input_dict)
12
+ print(result)
13
+ return result[0]
14
+
15
+
16
+ title="vgg13_imagenet"
17
+ description="VGG is an image classification model proposed by the Oxford University Computer Vision Group and DeepMind in 2014. This series of models explores the relationship between the depth of the convolutional neural network and its performance. It is experimentally proved that increasing the depth of the network can affect the final performance of the network to a certain extent. So far, VGG is still used by many other image tasks. BackBone network for feature extraction. The PaddleHub Module has a VGG13 structure and is trained on the ImageNet-2012 dataset. The input image size is 224 x 224 x 3, and it supports prediction directly through the command line or Python interface."
18
+
19
+ examples=[['cat2.jpg']]
20
+ gr.Interface(inference,gr.inputs.Image(type="filepath"),"label",title=title,description=description,examples=examples).launch(enable_queue=True,cache_examples=True)