Dennis Cahillane commited on
Commit
ce909ed
1 Parent(s): 3180bc4

try again: westworld ML files

Browse files
Files changed (6) hide show
  1. app.py +12 -0
  2. dennis-profile.jpg +0 -0
  3. dolores.jpg +0 -0
  4. hotdog.jpg +0 -0
  5. requirements.txt +1 -0
  6. westworld2.pkl +3 -0
app.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
+ import gradio as gr
3
+ title = 'Westworld host detector'
4
+ description = 'Avoid being killed by a host disguised as a human using this detector'
5
+ learn = load_learner('westworld2.pkl')
6
+ labels = learn.dls.vocab
7
+ def predict(img):
8
+ img = PILImage.create(img)
9
+ pred,pred_idx,probs = learn.predict(img)
10
+ return {labels[i]: float(probs[i]) for i in range(len(labels))}
11
+ examples = [['dolores.jpg'], ['hotdog.jpg']]
12
+ gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), examples=examples, title=title, description=description, outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
dennis-profile.jpg ADDED
dolores.jpg ADDED
hotdog.jpg ADDED
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ fastai
westworld2.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d96564a173571815bc02507cc77d9a653a07ef4bf93058ea9f4e7920343ddc55
3
+ size 46963361