Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import fastai
|
| 2 |
from fastai.vision.all import *
|
| 3 |
import gradio as gr
|
| 4 |
-
|
| 5 |
|
| 6 |
learn = load_learner('model.pkl')
|
| 7 |
|
|
@@ -12,6 +12,10 @@ def classify_img(img):
|
|
| 12 |
|
| 13 |
image = gr.inputs.Image(shape=(192,192))
|
| 14 |
label = gr.outputs.Label()
|
| 15 |
-
examples = [
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
iface = gr.Interface(fn = classify_img, inputs = image, outputs = label, title = 'Galaxy Classifier', examples = examples)
|
| 17 |
iface.launch()
|
|
|
|
| 1 |
import fastai
|
| 2 |
from fastai.vision.all import *
|
| 3 |
import gradio as gr
|
| 4 |
+
from PIL import Image
|
| 5 |
|
| 6 |
learn = load_learner('model.pkl')
|
| 7 |
|
|
|
|
| 12 |
|
| 13 |
image = gr.inputs.Image(shape=(192,192))
|
| 14 |
label = gr.outputs.Label()
|
| 15 |
+
examples = ['elliptical.jpg', 'irregular.jpg', 'spiral.jpg']
|
| 16 |
+
for img in examples:
|
| 17 |
+
img = Image.open(img)
|
| 18 |
+
img = img.resize((192,192), Image.NEAREST)
|
| 19 |
+
|
| 20 |
iface = gr.Interface(fn = classify_img, inputs = image, outputs = label, title = 'Galaxy Classifier', examples = examples)
|
| 21 |
iface.launch()
|