Spaces:
Runtime error
Runtime error
DavidFarrell
commited on
Commit
•
12655d2
1
Parent(s):
52810f4
baby steps
Browse files- abys.jpg +0 -0
- app.py +28 -0
- download (3).jpg +0 -0
- export.pkl +3 -0
abys.jpg
ADDED
app.py
CHANGED
@@ -1,5 +1,33 @@
|
|
1 |
import gradio as gr
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
def greet(name):
|
4 |
return "Hello " + name + "!!"
|
5 |
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
|
4 |
+
# %% drive/MyDrive/Colab Notebooks/fastbook/fastcourse/ch2minimal/tmabrahamgradio/gradiotest/gradiotest.ipynb 1
|
5 |
+
from fastai.vision.all import *
|
6 |
+
import skimage
|
7 |
+
|
8 |
+
# %% drive/MyDrive/Colab Notebooks/fastbook/fastcourse/ch2minimal/tmabrahamgradio/gradiotest/gradiotest.ipynb 4
|
9 |
+
learn = load_learner('export.pkl')
|
10 |
+
|
11 |
+
labels = learn.dls.vocab
|
12 |
+
|
13 |
+
def predict(img):
|
14 |
+
img = PILImage.create(img)
|
15 |
+
pred, pred_idx, probs = learn.predict(img)
|
16 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
# %% drive/MyDrive/Colab Notebooks/fastbook/fastcourse/ch2minimal/tmabrahamgradio/gradiotest/gradiotest.ipynb 7
|
22 |
+
#gr.Interface(fn=predict, inputs=gr.Image(shape=(512,512)), outputs=gr.outputs.Label(num_top_classes=3), title="Pet Breed Classifier", description="A pet breed classifier trained on the Oxford Pets dataset using the fastai library (5 epochs) as a proof of concept for Gradio.", article="<p style='text-align: center'><a href='https://gameologist.com/portfolio' target='_blank'>see more of my things here</a></p>", examples=['abys.jpg', 'download (3).jpg'], enable_queue=True).launch()
|
23 |
+
|
24 |
+
#iface = gr.Interface(fn=predict, inputs=gr.Image(shape=(512,512)), outputs=gr.outputs.Label(num_top_classes=3))
|
25 |
+
#iface.launch();
|
26 |
+
|
27 |
+
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
def greet(name):
|
32 |
return "Hello " + name + "!!"
|
33 |
|
download (3).jpg
ADDED
export.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:37b1f46c87b7f1257d475ecc7205bdf8f283dc55b1be48192e91c11e3babd7f6
|
3 |
+
size 103072981
|