Spaces:
Sleeping
Sleeping
waddaheaven
commited on
Commit
•
24bea3e
1
Parent(s):
1ee99c4
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
from fastai.vision.all import load_learner
|
2 |
import gradio as gr
|
3 |
|
4 |
-
|
5 |
"Art Nouveau",
|
6 |
"Constructivism Art",
|
7 |
"Cubism Art",
|
@@ -17,11 +17,11 @@ art_labels= [
|
|
17 |
model = load_learner('models/artStyle_recognizer-v5.pk1')
|
18 |
|
19 |
def recognize_image(image):
|
20 |
-
|
21 |
return dict(zip(art_labels, map(float, probs)))
|
22 |
|
23 |
-
image = gr.Image()
|
24 |
-
label = gr.Label()
|
25 |
example = [
|
26 |
'Art Nouvaeu.jpg',
|
27 |
'Constructivism art.jpg',
|
@@ -31,4 +31,4 @@ example = [
|
|
31 |
]
|
32 |
|
33 |
iface = gr.Interface(fn = recognize_image, inputs= image, outputs = label, examples = example)
|
34 |
-
iface.launch(inline=False)
|
|
|
1 |
from fastai.vision.all import load_learner
|
2 |
import gradio as gr
|
3 |
|
4 |
+
art_labedls= [
|
5 |
"Art Nouveau",
|
6 |
"Constructivism Art",
|
7 |
"Cubism Art",
|
|
|
17 |
model = load_learner('models/artStyle_recognizer-v5.pk1')
|
18 |
|
19 |
def recognize_image(image):
|
20 |
+
pred, idx, probs = model.predict(image)
|
21 |
return dict(zip(art_labels, map(float, probs)))
|
22 |
|
23 |
+
image = gr.inputs.Image()
|
24 |
+
label = gr.outputs.Label()
|
25 |
example = [
|
26 |
'Art Nouvaeu.jpg',
|
27 |
'Constructivism art.jpg',
|
|
|
31 |
]
|
32 |
|
33 |
iface = gr.Interface(fn = recognize_image, inputs= image, outputs = label, examples = example)
|
34 |
+
iface.launch(inline=False, share=True)
|