Spaces:
Build error
Build error
liquidaudit commited on
Commit ·
2c25b9c
1
Parent(s): 105efcc
added model and updated ui
Browse files- app.py +15 -4
- lightning.jpeg +0 -0
- model.pkl +3 -0
- rain.jpeg +0 -0
- snow.jpeg +0 -0
app.py
CHANGED
|
@@ -1,7 +1,18 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
return "Hello " + name + "!!"
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from fastai.vision.all import *
|
| 3 |
|
| 4 |
+
learn = load_learner('/kaggle/input/datadump/model.pkl')
|
|
|
|
| 5 |
|
| 6 |
+
labels = learn.dls.vocab
|
| 7 |
+
def predict(img):
|
| 8 |
+
img = PILImage.create(img)
|
| 9 |
+
pred,pred_idx,probs = learn.predict(img)
|
| 10 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 11 |
+
|
| 12 |
+
title = "Weather Classifier"
|
| 13 |
+
description = "A classifer trained to predict the weather in an image. Created as a demo for Gradio and HuggingFace Spaces."
|
| 14 |
+
examples = [['./lightning.jpeg'],['./rain.jpeg'],['./snow.jpeg']]
|
| 15 |
+
interpretation='default'
|
| 16 |
+
enable_queue=True
|
| 17 |
+
|
| 18 |
+
gr.Interface(fn=predict,inputs=gr.components.Image(shape=(512, 512)),outputs=gr.components.Label(num_top_classes=11),title=title,description=description,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch()
|
lightning.jpeg
ADDED
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8c0bd1ab98cc4acbd043dfadb4535b1f2a4ea4cec56bb579f18da90a28f527c2
|
| 3 |
+
size 47090671
|
rain.jpeg
ADDED
|
snow.jpeg
ADDED
|