zhangzonglin1
commited on
Commit
·
8d27eef
1
Parent(s):
9e5074d
Add application file
Browse files
app.py
CHANGED
@@ -1,7 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
# coding: utf-8
|
3 |
+
|
4 |
+
# In[ ]:
|
5 |
+
|
6 |
+
|
7 |
+
learn = learner.load("/kaggle/working/export.pkl")
|
8 |
+
|
9 |
+
def classify_image(img):
|
10 |
+
pred,idx,probs = learn.predict(img)
|
11 |
+
return dict(zip(categories,map(float,probs)))
|
12 |
+
|
13 |
import gradio as gr
|
14 |
+
image = gr.inputs.Image(shape=(192,192))
|
15 |
+
label = gr.outputs.Label()
|
16 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label)
|
17 |
+
intf.launch(inline=False)
|
18 |
+
|
19 |
+
|
20 |
+
# In[3]:
|
21 |
+
|
22 |
+
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
# In[4]:
|
27 |
+
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
# In[ ]:
|
33 |
+
|
34 |
+
|
35 |
|
|
|
|
|
36 |
|
|
|
|