JP Hwang commited on
Commit
4bb083d
·
1 Parent(s): f0b2c7e

Updated resnet model and added test script

Browse files
Files changed (5) hide show
  1. .gitignore +2 -0
  2. app.py +1 -1
  3. architecture.pkl +2 -2
  4. requirements.txt +1 -0
  5. test_basic_api.py +15 -0
.gitignore CHANGED
@@ -1,6 +1,8 @@
1
  # Project specific
2
  .idea
 
3
  venv
 
4
 
5
  # Byte-compiled / optimized / DLL files
6
  __pycache__/
 
1
  # Project specific
2
  .idea
3
+ .DS_Store
4
  venv
5
+ images
6
 
7
  # Byte-compiled / optimized / DLL files
8
  __pycache__/
app.py CHANGED
@@ -10,7 +10,7 @@ description = """
10
  Upload a picture to this architectural classifier trained with fast.ai.
11
  """
12
  article = """
13
- I hope to learn more about various architectural styles with this tool during my travels to Europe.
14
  """
15
 
16
  def predict(imgpath):
 
10
  Upload a picture to this architectural classifier trained with fast.ai.
11
  """
12
  article = """
13
+ We hope you found this useful!
14
  """
15
 
16
  def predict(imgpath):
architecture.pkl CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:b8428f71bbb7810c7a924e00c688fb104d12e143906ba768aa7e52674783d588
3
- size 87675873
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7e1ef2cf8f7eb8ee23d05374a716f91311c826b0e38dfe103ce0b2004ef04498
3
+ size 103094229
requirements.txt CHANGED
@@ -1,2 +1,3 @@
1
  fastai
 
2
  timm
 
1
  fastai
2
+ gradio
3
  timm
test_basic_api.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import base64
3
+ import json
4
+
5
+ parcels_files_url = 'https://hf.space/embed/jphwang/architectural_styles/+/api/predict'
6
+ fname = "images/dean-village.jpg"
7
+ encoded = base64.b64encode(open(fname, "rb").read())
8
+ data = json.dumps(f'data:image/{fname[-3:]};base64,' + encoded.decode())
9
+ r = requests.post(
10
+ url=parcels_files_url,
11
+ json={"data": [data]
12
+ })
13
+ resp = r.json()
14
+ print(resp)
15
+