Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
|
4 |
+
learn = load_learner('Landschaften.pkl')
|
5 |
+
labels = learn.dls.vocab
|
6 |
+
|
7 |
+
def predict(img):
|
8 |
+
pred,pred_idx,probs = learn.predict(img)
|
9 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
10 |
+
|
11 |
+
title = "Land, Berge oder Strand?"
|
12 |
+
description = "Ein Klassifikator für drei Landschaften in Bildern"
|
13 |
+
interpretation='default'
|
14 |
+
enable_queue=True
|
15 |
+
|
16 |
+
iface = gr.Interface(fn=predict,
|
17 |
+
inputs=gr.Image(shape=(512, 512)),
|
18 |
+
outputs=gr.Label(),
|
19 |
+
title=title,
|
20 |
+
description=description)
|
21 |
+
iface.queue()
|
22 |
+
iface.launch()
|