Spaces:
Running
Running
Commit
·
4a40774
1
Parent(s):
3aa5d56
init commit
Browse files- amish.jpg +0 -0
- app.py +18 -0
- japandi.jpg +0 -0
amish.jpg
ADDED
![]() |
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
categories = ['Abstract', 'African', 'American Colonial', 'Amish', 'Arabian', 'Art Deco', 'Art Moderne', 'Art Nouveau', 'Artisan', 'Arts & Crafts', 'Asian', 'Baroque', 'Bauhaus', 'Beach House', 'Bohemian', 'Brazilian', 'British Colonial', 'Carolean', 'Chinese', 'Chippendale', 'Coastal', 'Commonwealth', 'Contemporary', 'Cool Britannia', 'Cottage', 'Country', 'Danish', 'Directoire', 'Dutch Renaissance', 'Eclectic', 'Egyptian', 'Elizabethan', 'Empire', 'English', 'English Country', 'European', 'Exploration', 'Farmhouse', 'Finnish', 'Flemish', 'French', 'French Provincial', 'Georgian', 'Gothic', 'Greek', 'Hygge', 'Indian', 'Industrial', 'Italian', 'Jacobean', 'Japandi', 'Japanese', 'Lake House', 'Machine Age', 'Maximalist', 'Medieval', 'Mediterranean', 'Memphis', 'Mexican', 'Mid-Century Modern', 'Minimalist', 'Mission', 'Modern', 'Modernist', 'Moroccan', 'Nautical', 'Neoclassic', 'Northwestern', 'Old World', 'Organic', 'Palladian', 'Parisian', 'Pennsylvania Dutch', 'Plantation', 'Post-Modern', 'Puritan', 'Queen Anne', 'Regal', 'Regence', 'Regency', 'Renaissance', 'Retro', 'Revival', 'Rietveld', 'Rococo', 'Romantic', 'Russian', 'Rustic', 'Scandinavian', 'Shabby Chic', 'Shaker', 'Southwestern', 'Space Age', 'Spanish Renaissance', 'Steampunk', 'Swedish', 'Traditional', 'Transitional', 'Tropical', 'Tudor', 'Tuscan', 'Urban', 'Venetian', 'Victorian', 'Vintage', 'Western', 'William & Mary', 'Zen']
|
5 |
+
|
6 |
+
learn = load_learner('model.pkl')
|
7 |
+
|
8 |
+
def classify_image(img):
|
9 |
+
pred, idx, probs = learn.predict(img)
|
10 |
+
return dict(zip(categories, map(float,probs)))
|
11 |
+
|
12 |
+
|
13 |
+
image = gr.inputs.Image()
|
14 |
+
label = gr.outputs.Label()
|
15 |
+
examples = ['Japandi.jpg', 'Amish.jpg']
|
16 |
+
|
17 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
18 |
+
intf.launch(inline=False)
|
japandi.jpg
ADDED
![]() |