Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,21 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
def greet(name):
|
| 4 |
-
return "Hello " + name + "!!"
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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)
|