NickHerrig commited on
Commit
bd16a43
1 Parent(s): 74d8259

Add model weights, update gradio app

Browse files
Files changed (2) hide show
  1. app.py +8 -3
  2. model_weights.pth +3 -0
app.py CHANGED
@@ -1,7 +1,12 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return f"Hello {name}, Welcome!"
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
 
7
  demo.launch()
 
1
  import gradio as gr
2
+ from fastai.vision.all import *
3
 
4
+ learn = load_learner("model_weights.pth")
 
5
 
6
+ def predict(image):
7
+ drink, _, probs = learn.predict(image)
8
+ probability = max(list(map(float, probs)))
9
+ return f"this is most likely a {drink} with probability {probability}."
10
+
11
+ demo = gr.Interface(fn=predict, inputs="image", outputs="text")
12
  demo.launch()
model_weights.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5159615d1ee6d3cb06f52082a5727e5879bf26177f30397e2349714d076299ff
3
+ size 47006070