Spaces:
Build error
Build error
JP Hwang
commited on
Commit
·
96521df
1
Parent(s):
8e333aa
added text
Browse files
app.py
CHANGED
|
@@ -5,6 +5,14 @@ from fastcore import *
|
|
| 5 |
learn = load_learner('architecture.pkl')
|
| 6 |
labels = learn.dls.vocab
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
def predict(imgpath):
|
| 9 |
img = PILImage.create(imgpath)
|
| 10 |
pred, pred_idx, probs = learn.predict(img)
|
|
@@ -13,5 +21,8 @@ def predict(imgpath):
|
|
| 13 |
gr.Interface(
|
| 14 |
fn=predict,
|
| 15 |
inputs=gr.inputs.Image(shape=(512, 512)),
|
| 16 |
-
outputs=gr.outputs.Label(num_top_classes=3)
|
|
|
|
|
|
|
|
|
|
| 17 |
).launch()
|
|
|
|
| 5 |
learn = load_learner('architecture.pkl')
|
| 6 |
labels = learn.dls.vocab
|
| 7 |
|
| 8 |
+
title = "Architectural style clasisfier"
|
| 9 |
+
description = """
|
| 10 |
+
Upload a picture to this architectural classifier trained with fast.ai.
|
| 11 |
+
"""
|
| 12 |
+
article = """
|
| 13 |
+
I hope to learn more about various architectural styles with this tool during my travels to Europe.
|
| 14 |
+
"""
|
| 15 |
+
|
| 16 |
def predict(imgpath):
|
| 17 |
img = PILImage.create(imgpath)
|
| 18 |
pred, pred_idx, probs = learn.predict(img)
|
|
|
|
| 21 |
gr.Interface(
|
| 22 |
fn=predict,
|
| 23 |
inputs=gr.inputs.Image(shape=(512, 512)),
|
| 24 |
+
outputs=gr.outputs.Label(num_top_classes=3),
|
| 25 |
+
title=title,
|
| 26 |
+
description=description,
|
| 27 |
+
article=article
|
| 28 |
).launch()
|