Spaces:
Runtime error
Runtime error
Jessica Walkenhorst
commited on
Commit
β’
cb79428
1
Parent(s):
13d45d2
Flatten repository structure
Browse files
app.py
CHANGED
@@ -2,8 +2,8 @@ from pathlib import Path
|
|
2 |
from fastai.vision.learner import load_learner
|
3 |
import gradio as gr
|
4 |
|
5 |
-
MODELPATH
|
6 |
-
|
7 |
|
8 |
learn = load_learner(MODELPATH)
|
9 |
categories = learn.dls.vocab
|
@@ -15,7 +15,7 @@ def classify_image(image):
|
|
15 |
title = 'Mirror, mirror on the wall am I a duckling or a cygnet after all?'
|
16 |
description = """Hans Christian Andersen's tale of the ugly duckling tells us about the sad youth of a cygnet acidentally being brought up in a family of ducks and being ostrized for its ugliness.\n But what if the poor cygnet had a magic mirror to tell it that it was in fact a young swan after all? Machine learning to the rescue!"""
|
17 |
|
18 |
-
examples =
|
19 |
|
20 |
app = gr.Interface(fn=classify_image,
|
21 |
inputs=gr.components.Image(),
|
|
|
2 |
from fastai.vision.learner import load_learner
|
3 |
import gradio as gr
|
4 |
|
5 |
+
MODELPATH='cygnet-vs-duckling.pkl'
|
6 |
+
EXAMPLEFOLDER = Path().cwd()
|
7 |
|
8 |
learn = load_learner(MODELPATH)
|
9 |
categories = learn.dls.vocab
|
|
|
15 |
title = 'Mirror, mirror on the wall am I a duckling or a cygnet after all?'
|
16 |
description = """Hans Christian Andersen's tale of the ugly duckling tells us about the sad youth of a cygnet acidentally being brought up in a family of ducks and being ostrized for its ugliness.\n But what if the poor cygnet had a magic mirror to tell it that it was in fact a young swan after all? Machine learning to the rescue!"""
|
17 |
|
18 |
+
examples = EXAMPLEFOLDER.glob('*.jpg')
|
19 |
|
20 |
app = gr.Interface(fn=classify_image,
|
21 |
inputs=gr.components.Image(),
|
model/cygnet-vs-duckling.pkl β cygnet-vs-duckling.pkl
RENAMED
File without changes
|
example-images/duckling.jpg β duckling.jpg
RENAMED
File without changes
|