gitanshgarg commited on
Commit
99ffcd5
·
verified ·
1 Parent(s): 42bc710

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -3
app.py CHANGED
@@ -1,7 +1,21 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  iface.launch(share=True)
 
1
  import gradio as gr
2
+ from fastai.vision.all import *
3
 
 
 
4
 
5
+ learn = load_learner('drinks.pkl')
6
+
7
+
8
+ categories = ('Coca Cola', 'Lahori Zeera', 'Monster')
9
+
10
+
11
+ def classify_drinks(img):
12
+ pred,idx,probs = learn.predict(img)
13
+ return dict(zip(categories, map(float, probs)))
14
+
15
+
16
+ img = gr.inputs.Image(shape = (192,192))
17
+ label = gr.outputs.Label()
18
+
19
+
20
+ iface = gr.Interface(fn=classify_images, inputs=img, outputs=label)
21
  iface.launch(share=True)