muellerzr HF staff commited on
Commit
582e715
1 Parent(s): 66a0d4a

Actually push

Browse files
Files changed (2) hide show
  1. src/__init__.py +0 -0
  2. src/app.py +19 -0
src/__init__.py ADDED
File without changes
src/app.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from fastai.learner import load_learner
3
+ from fastai.vision.core import PILImage
4
+
5
+ # Load the model
6
+ learn = load_learner('exported_fastai.pkl', cpu=False)
7
+
8
+ def classify_image(inp):
9
+ inp = PILImage.create(inp)
10
+ pred, _, _ = learn.predict(inp)
11
+ return pred
12
+
13
+ iface = gr.Interface(
14
+ fn=classify_image,
15
+ inputs=gr.inputs.Image(),
16
+ outputs="text",
17
+ title="Fastai Classifier",
18
+ description="An example of using Fastai in Gradio.",
19
+ ).launch()