Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test #81

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

Test #81

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: python app/server.py serve
10 changes: 7 additions & 3 deletions app/server.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import aiohttp
import asyncio
import uvicorn
import os
import requests
from fastai import *
from fastai.vision import *
from io import BytesIO
Expand All @@ -9,10 +11,12 @@
from starlette.responses import HTMLResponse, JSONResponse
from starlette.staticfiles import StaticFiles

export_file_url = 'https://www.dropbox.com/s/6bgq8t6yextloqp/export.pkl?raw=1'
export_file_url = 'https://www.dropbox.com/s/2w5fwbf51ovz2aj/export.pkl?dl=1'
export_file_name = 'export.pkl'

classes = ['black', 'grizzly', 'teddys']
Port = int(os.environ.get('PORT', 50000))

classes = ['social dist', 'no social dist']
path = Path(__file__).parent

app = Starlette()
Expand Down Expand Up @@ -66,4 +70,4 @@ async def analyze(request):

if __name__ == '__main__':
if 'serve' in sys.argv:
uvicorn.run(app=app, host='0.0.0.0', port=5000, log_level="info")
uvicorn.run(app=app, host='0.0.0.0', port=Port, log_level="info")
5 changes: 2 additions & 3 deletions app/view/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
<body>
<div>
<div class='center'>
<div class='title'>Classify Bear Images 🐻</div>
<div class='title'>Check if social distancing is being followed or not.</div>
<p>
Use images of <strong>teddy</strong> bears, <strong>black</strong> bears, <strong>grizzly</strong> bears, or
all three!
Use images from <strong>drones</strong>, <strong>CCTV</strong>, etc!
</p>
<div class='content'>
<div class='no-display'>
Expand Down
14 changes: 7 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
aiofiles==0.5.0
aiohttp==3.6.2
aiofiles==0.4.0
aiohttp==3.5.4
asyncio==3.4.3
fastai==1.0.61
torch==1.6.0
torchvision==0.7.0
numpy==1.19.0
pillow~=7.2
https://download.pytorch.org/whl/cpu/torch-1.1.0-cp37-cp37m-linux_x86_64.whl
https://download.pytorch.org/whl/cpu/torchvision-0.3.0-cp37-cp37m-linux_x86_64.whl
numpy==1.16.3
pillow~=7.1.0
python-multipart==0.0.5
starlette==0.13.6
starlette==0.12.0
uvicorn==0.11.7
1 change: 1 addition & 0 deletions runtime.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python-3.7.7