enricorampazzo commited on
Commit
a456c40
·
1 Parent(s): 0705d34

model works, tracked with git lfs

Browse files
Files changed (5) hide show
  1. .gitattributes +1 -0
  2. .idea/.gitignore +3 -0
  3. app.py +43 -0
  4. requirements.txt +4 -0
  5. room_classifier.pk1 +3 -0
.gitattributes CHANGED
@@ -32,3 +32,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
35
+ room_classifier.pk1 filter=lfs diff=lfs merge=lfs -text
.idea/.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
app.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AUTOGENERATED! DO NOT EDIT! File to edit: ../drive/MyDrive/Colab Notebooks/room classifier to app.ipynb.
2
+
3
+ # %% auto 0
4
+ __all__ = ['learner', 'image', 'label', 'examples', 'intf', 'classify_image']
5
+
6
+ # %% ../drive/MyDrive/Colab Notebooks/room classifier to app.ipynb 2
7
+ import platform
8
+
9
+ import fastbook
10
+ import fastai
11
+ from fastai.vision.widgets import *
12
+ from fastai.callback.preds import load_learner
13
+ from fastai.vision.all import *
14
+
15
+ fastbook.setup_book()
16
+
17
+ # %% ../drive/MyDrive/Colab Notebooks/room classifier to app.ipynb 3
18
+ if platform.system().lower() == "windows":
19
+ import pathlib
20
+ posix_path = pathlib.PosixPath
21
+ pathlib.PosixPath = pathlib.WindowsPath
22
+ learner = load_learner("room_classifier.pk1")
23
+ if platform.system().lower() == "windows":
24
+ pathlib.PosixPath = posix_path
25
+
26
+
27
+ # %% ../drive/MyDrive/Colab Notebooks/room classifier to app.ipynb 14
28
+ def classify_image(img):
29
+ pred, idx, probs = learner.predict(img)
30
+ return dict(zip(learner.dls.vocab, map(float, probs)))
31
+
32
+
33
+
34
+ # %% ../drive/MyDrive/Colab Notebooks/room classifier to app.ipynb 16
35
+ import gradio as gr
36
+
37
+ image = gr.inputs.Image(shape=(192, 192))
38
+ label = gr.outputs.Label()
39
+ out_pl = widgets.Output()
40
+
41
+ examples = ["examples/test_bathroom.jfif", "examples/test_living_room.jfif", "examples/test_building.jfif"]
42
+ intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
43
+ intf.launch()
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ fastbook
2
+ fastai
3
+ gradio
4
+ numpy<1.24
room_classifier.pk1 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2b2a5b0283aabd3bb8c513de16266ecbd5fafa8e61dc79fe1510423cad98c55d
3
+ size 46958127