Spaces:
Runtime error
Runtime error
Add dog classification
Browse files
app.py
CHANGED
@@ -1,7 +1,25 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
def greet(name):
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|