Tony Neel commited on
Commit
076277f
·
1 Parent(s): 98c7126

first commit

Browse files
Files changed (2) hide show
  1. model.pkl +3 -0
  2. single.html +19 -0
model.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:878efd6ac561fef1abf241a011f280a93e2d608db43309ba233b708d08224c17
3
+ size 47061483
single.html ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <input id="photo" type="file">
2
+ <div id="results"></div>
3
+ <script>
4
+ async function loaded(reader) {
5
+ const response = await fetch('https://hf.space/embed/jph00/pets/+/api/predict/', {
6
+ method: "POST", body: JSON.stringify({ "data": [reader.result] }),
7
+ headers: { "Content-Type": "application/json" }
8
+ });
9
+ const json = await response.json();
10
+ const label = json['data'][0]['confidences'][0]['label'];
11
+ results.innerHTML = `<br/><img src="${reader.result}" width="300"> <p>${label}</p>`
12
+ }
13
+ function read() {
14
+ const reader = new FileReader();
15
+ reader.addEventListener('load', () => loaded(reader))
16
+ reader.readAsDataURL(photo.files[0]);
17
+ }
18
+ photo.addEventListener('input', read);
19
+ </script>