Spaces:
Runtime error
Runtime error
final final nadal vs djokovcid
Browse files
app.py
CHANGED
@@ -1,13 +1,19 @@
|
|
1 |
import gradio as gr
|
2 |
from fastai.vision.all import *
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
-
categories = ["great white", "zebra", "whale", "lemon", "thresher"]
|
5 |
learner = load_learner("shark_recognizer.pkl")
|
6 |
def recognize_shark(img):
|
7 |
pred, idx, probs = learner.predict(img)
|
|
|
8 |
return dict(zip(categories, map(float, probs)))
|
9 |
|
10 |
image = gr.inputs.Image()
|
11 |
label = gr.outputs.Label()
|
12 |
-
iface = gr.Interface(fn=recognize_shark, inputs=image, outputs=label)
|
13 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
from fastai.vision.all import *
|
3 |
+
from duckduckgo_search import ddg_images
|
4 |
+
from pathlib import Path
|
5 |
+
|
6 |
+
examples = [i for i in Path("./examples").glob("*")]
|
7 |
+
categories = ["great white", "lemon", "thresher", "whale", "zebra"]
|
8 |
+
|
9 |
|
|
|
10 |
learner = load_learner("shark_recognizer.pkl")
|
11 |
def recognize_shark(img):
|
12 |
pred, idx, probs = learner.predict(img)
|
13 |
+
|
14 |
return dict(zip(categories, map(float, probs)))
|
15 |
|
16 |
image = gr.inputs.Image()
|
17 |
label = gr.outputs.Label()
|
18 |
+
iface = gr.Interface(fn=recognize_shark, inputs=image, outputs=label, examples = examples)
|
19 |
iface.launch()
|