akstrov commited on
Commit
9209547
1 Parent(s): fae11d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -24
app.py CHANGED
@@ -1,25 +1,26 @@
1
- import gradio as gr
2
- import os
3
- from fastai.vision.all import *
4
-
5
-
6
- def image_mod(image):
7
- learn_inf = load_learner("model.pkl")
8
- return learn_inf.predict(image)[0]
9
-
10
-
11
- demo = gr.Interface(
12
- image_mod,
13
- gr.Image(type="pil"),
14
- "image",
15
- flagging_options=["blurry", "incorrect", "other"],
16
- examples=[
17
- os.path.join(os.path.dirname(__file__), "images/cheetah1.jpg"),
18
- os.path.join(os.path.dirname(__file__), "images/lion.jpg"),
19
- os.path.join(os.path.dirname(__file__), "images/logo.png"),
20
- os.path.join(os.path.dirname(__file__), "images/tower.jpg"),
21
- ],
22
- )
23
-
24
- if __name__ == "__main__":
 
25
  demo.launch()
 
1
+ !pip install fastai
2
+ import gradio as gr
3
+ import os
4
+ from fastai.vision.all import *
5
+
6
+
7
+ def image_mod(image):
8
+ learn_inf = load_learner("model.pkl")
9
+ return learn_inf.predict(image)[0]
10
+
11
+
12
+ demo = gr.Interface(
13
+ image_mod,
14
+ gr.Image(type="pil"),
15
+ "image",
16
+ flagging_options=["blurry", "incorrect", "other"],
17
+ examples=[
18
+ os.path.join(os.path.dirname(__file__), "images/cheetah1.jpg"),
19
+ os.path.join(os.path.dirname(__file__), "images/lion.jpg"),
20
+ os.path.join(os.path.dirname(__file__), "images/logo.png"),
21
+ os.path.join(os.path.dirname(__file__), "images/tower.jpg"),
22
+ ],
23
+ )
24
+
25
+ if __name__ == "__main__":
26
  demo.launch()