Spaces:
Sleeping
Sleeping
Replacing test app.py file w/ bearsprediction
Browse files- app-test.py +7 -0
- app.py +19 -4
- bearmodel.pkl +3 -0
app-test.py
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
|
3 |
+
def greet(name):
|
4 |
+
return "Hello " + name + "!!"
|
5 |
+
|
6 |
+
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
7 |
+
demo.launch().share=True
|
app.py
CHANGED
@@ -1,7 +1,22 @@
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
import gradio as gr
|
3 |
|
4 |
+
learn = load_learner('model.pkl')
|
|
|
5 |
|
6 |
+
def predict(img):
|
7 |
+
img = PILImage.create(img)
|
8 |
+
pred,pred_idx,probs = learn.predict(img)
|
9 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
10 |
+
|
11 |
+
image = gr.Image(height=192, width=192)
|
12 |
+
label = gr.Label()
|
13 |
+
|
14 |
+
intf = gr.Interface(fn=predict, inputs=image, outputs=label)
|
15 |
+
intf.launch(inline=False)
|
16 |
+
|
17 |
+
|
18 |
+
#def greet(name):
|
19 |
+
# return "Hello " + name + "!!"
|
20 |
+
|
21 |
+
#demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
22 |
+
#demo.launch()
|
bearmodel.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:947d5303ccaa49964b3f08f99970618b6ee2e1a38545e34efb64a36786aa53d1
|
3 |
+
size 46974526
|