bisoudunord commited on
Commit
cc43537
1 Parent(s): ac942f2

Upload app.py

Browse files

initial upload

Files changed (1) hide show
  1. app.py +46 -0
app.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # -*- coding: utf-8 -*-
2
+ """jet_classifier_2020.ipynb
3
+
4
+ Automatically generated by Colab.
5
+
6
+ Original file is located at
7
+ https://colab.research.google.com/drive/1k58WRaHBA0ndeIlVSDUk9QPywUFZkWPl
8
+
9
+ ##Test
10
+ Previously trained model from 2020 (using vgg), testing if it is still deployable. have to upload my Pickle file(fighter_jets_model_3_vgg.pkl) onto this server. might take a bit of time to upload
11
+ """
12
+
13
+
14
+
15
+ #|default_exp app
16
+
17
+ #|export
18
+ # importing fastai library
19
+ from fastai.vision.all import *
20
+ import gradio as gr
21
+ import skimage
22
+
23
+
24
+ #|export
25
+ learn = load_learner('fighter_jets_model_3_vgg.pkl')
26
+
27
+ #|export
28
+ labels = learn.dls.vocab
29
+ def predict(img):
30
+ img = PILImage.create(img)
31
+ pred,pred_idx,probs = learn.predict(img)
32
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
33
+
34
+
35
+ """## Gradio
36
+ trying it on gradio
37
+ """
38
+
39
+ #|export
40
+ title = "Moder Fighter Jet Classifier"
41
+ description = "Finetuned VGG neural net using less then 50 photos per aircraft"
42
+ interpretation = "default"
43
+ enable_queue = True
44
+ gr.Interface(fn=predict, inputs="image", outputs="label", title=title,description=description).launch(share=True)
45
+
46
+