akhaliq HF staff commited on
Commit
a741273
1 Parent(s): 37f055b

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import paddlehub as hub
3
+ import cv2
4
+
5
+ classifier = hub.Module(name="mobilenet_v2_dishes")
6
+
7
+ def inference(img):
8
+ result = classifier.classification(images=[cv2.imread(img)])
9
+ print(result)
10
+ return result[0]
11
+
12
+
13
+ title="mobilenet_v2_dishes"
14
+ description="MobileNet V2 is a lightweight convolutional neural network. On the basis of MobileNet, it has made two major improvements: Inverted Residuals and Linear bottlenecks. The PaddleHub Module is trained on Baidu's self-built dishes dataset and can be used for image classification and feature extraction. Currently, it supports the classification and recognition of 8416 dishes."
15
+
16
+ examples=[['dish.jpg']]
17
+ gr.Interface(inference,gr.inputs.Image(type="filepath"),"label",title=title,description=description,examples=examples).launch(enable_queue=True,cache_examples=True)