teamtom commited on
Commit
4a32a5c
1 Parent(s): 20cca51

adding my files

Browse files
.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
+ *.jpg filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastai.vision.all import *
2
+ import gradio as gr
3
+ import pathlib, os
4
+
5
+
6
+ classes = ['rock', 'paper', 'scissors'] # c0, c1, c2
7
+
8
+ def classify_image(img, model):
9
+ if os.name == 'nt': # workaround for Windows
10
+ pathlib.PosixPath = pathlib.WindowsPath
11
+ if os.name == 'posix': # workaround for Linux
12
+ pathlib.WindowsPath = pathlib.PosixPath
13
+
14
+ learn = load_learner(model)
15
+ pred,idx,probs = learn.predict(img)
16
+ return dict(zip(classes, map(float, probs)))
17
+
18
+ models = ['rock-paper-scissors-squeezenet.pkl','rock-paper-scissors-resnet34.pkl']
19
+ model = gr.Dropdown(models, label="Select Model")
20
+
21
+ image = gr.inputs.Image(shape=(192,192))
22
+ label = gr.outputs.Label()
23
+ examples = [
24
+ ['c0-rock-IMG_20230225_171937.jpg'],
25
+ ['c0-rock-IMG_20230225_171940.jpg'],
26
+ ['c1-paper-IMG_20230225_172010.jpg'],
27
+ ['c1-paper-IMG_20230225_172018.jpg'],
28
+ ['c2-scissors-IMG_20230225_172025.jpg'],
29
+ ['c2-scissors-IMG_20230225_172033.jpg']
30
+ ]
31
+
32
+ # iface = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
33
+ iface = gr.Interface(fn=classify_image, inputs=[image, model], outputs=label, examples=examples)
34
+ iface.launch()
c0-rock-IMG_20230225_171937.jpg ADDED

Git LFS Details

  • SHA256: 9e0dc877aa9cf0101f91c307d58d73c498c6ec47c5af80fd1c81e5547cbe15d0
  • Pointer size: 132 Bytes
  • Size of remote file: 1.05 MB
c0-rock-IMG_20230225_171940.jpg ADDED

Git LFS Details

  • SHA256: cac9b9eac6da63ae064bbf1b89e49bd3fcb5d2d0a2349ae1b7fdc1b1672636d4
  • Pointer size: 131 Bytes
  • Size of remote file: 708 kB
c1-paper-IMG_20230225_172010.jpg ADDED

Git LFS Details

  • SHA256: bfd7c8debe988b6d2342572ae68fa4948a10d4b1fba8b8be01f9a233c0210a3e
  • Pointer size: 131 Bytes
  • Size of remote file: 790 kB
c1-paper-IMG_20230225_172018.jpg ADDED

Git LFS Details

  • SHA256: 7ca775632ce16f704b609cdecc7a47e8a825f898bf7e556107df3ba8b1759674
  • Pointer size: 131 Bytes
  • Size of remote file: 637 kB
c2-scissors-IMG_20230225_172025.jpg ADDED

Git LFS Details

  • SHA256: 23bc8e9c943a945730d65ad7e3a3260e3c3b78cb808d6b323e1a8013fa4db829
  • Pointer size: 131 Bytes
  • Size of remote file: 800 kB
c2-scissors-IMG_20230225_172033.jpg ADDED

Git LFS Details

  • SHA256: 11a2a1a0d6a321a239d7ea0ce62613b479dbcddb2e82c08b57101e050cd56c3e
  • Pointer size: 131 Bytes
  • Size of remote file: 652 kB
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ fastai
2
+ torch
3
+ gradio
rock-paper-scissors-resnet34.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2cd76ad5e04de5d1057ea787ca9a2620c2c073eeb4fec8b8d64466df54fbbabb
3
+ size 87523036
rock-paper-scissors-squeezenet.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9520376833818d557b0c9028043bb84ea8c9d1a9dd34210f4071748d59761aed
3
+ size 5167991