Delete app.py
Browse files
app.py
DELETED
@@ -1,19 +0,0 @@
|
|
1 |
-
#|default_exp app
|
2 |
-
# %% [code] {"execution":{"iopub.status.busy":"2023-01-17T14:41:33.341222Z","iopub.execute_input":"2023-01-17T14:41:33.341652Z","iopub.status.idle":"2023-01-17T14:41:34.776787Z","shell.execute_reply.started":"2023-01-17T14:41:33.341595Z","shell.execute_reply":"2023-01-17T14:41:34.775663Z"}}
|
3 |
-
#|export
|
4 |
-
from fastai.vision.all import *
|
5 |
-
import gradio as gr
|
6 |
-
|
7 |
-
# %% [code] {"execution":{"iopub.status.busy":"2023-01-17T14:43:57.890571Z","iopub.execute_input":"2023-01-17T14:43:57.891069Z","iopub.status.idle":"2023-01-17T14:43:58.607922Z","shell.execute_reply.started":"2023-01-17T14:43:57.891028Z","shell.execute_reply":"2023-01-17T14:43:58.606710Z"}}
|
8 |
-
#|export
|
9 |
-
learn = load_learner('/minima/model.pkl')
|
10 |
-
|
11 |
-
# %% [code] {"execution":{"iopub.status.busy":"2023-01-17T14:45:36.880658Z","iopub.execute_input":"2023-01-17T14:45:36.881241Z","iopub.status.idle":"2023-01-17T14:45:36.890302Z","shell.execute_reply.started":"2023-01-17T14:45:36.881102Z","shell.execute_reply":"2023-01-17T14:45:36.889172Z"}}
|
12 |
-
labels = learn.dls.vocab
|
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 |
-
# %% [code] {"execution":{"iopub.status.busy":"2023-01-17T14:46:08.717339Z","iopub.execute_input":"2023-01-17T14:46:08.717913Z","iopub.status.idle":"2023-01-17T14:46:15.759750Z","shell.execute_reply.started":"2023-01-17T14:46:08.717858Z","shell.execute_reply":"2023-01-17T14:46:15.758401Z"}}
|
19 |
-
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|