erenska commited on
Commit
fe0f2aa
·
1 Parent(s): e8da0c7

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -20
app.py DELETED
@@ -1,20 +0,0 @@
1
- #|default_exp app
2
-
3
- # %% [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"}}
4
- #|export
5
- from fastai.vision.all import *
6
- import gradio as gr
7
-
8
- # %% [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"}}
9
- #|export
10
- learn = load_learner('/minima/model.pkl')
11
-
12
- # %% [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"}}
13
- labels = learn.dls.vocab
14
- def predict(img):
15
- img = PILImage.create(img)
16
- pred,pred_idx,probs = learn.predict(img)
17
- return {labels[i]: float(probs[i]) for i in range(len(labels))}
18
-
19
- # %% [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"}}
20
- gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)