Skip to content

Boilerplate to make a query in a corpus with Prevision Platform

Notifications You must be signed in to change notification settings

previsionio/prevision-nlp-query-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deploying an image detector app

Pre-requiste

  • An object detector model : This app only works with Object Detector models
  • client id
  • client secret
  • model url
  • optionnal : an app url, to generate doc

Setup for Dev

  • fork this project and then clone
  • fill the .env file ( see .env.example )
  • Create a python virtual env and install ( we advise you t use python 3.8)
git clone [email protected]:previsionio/prevision-object-detector-app.git
cd prevision-object-detector-app.git
python3.8 -m venv env
pip install -r requirements.txt 

Then create a .env file from the env.example and fill it with the information from your model

client_id=<YOUR CLIENT ID>>
client_secret=<YOUR CLIENT_SECRET>
model_url=<YOUR_MODEL_URL>

tokens model url

Then launch server using gunicorn

gunicorn --reload --bind 127.0.0.1:8080 --timeout 120  --limit-request-line 0   --access-logfile - run:app

Go to http://localhost:8080/ and check everything is fine. You should see a webapp. You can test the API with the curl command ( using any image you want ):

curl --location --request POST 'http://localhost:8080/api/model/prediction' \
--form 'img=@"./test_img.jpg"'

If both the webapp and curl command are ok, you can proceed to customisation or deployment

Customisation

Server is flask based with jinja as template engine. You can edit the app/templates/base.html to tweak your footer and header.

You can change the content of the app/templates/about page or add page to you project in the run.py file.

You can change colors and font in the app/styles.css file.

About your model, you can edit advice from object detected and threshold in the routers/blueprint_model/adviceabout function.

Prod

If everything is fine you can deploy to your account. Juste deploy a new app, do not forget to fill the env var with the content of your .env file.

deploy

deploy

deploy

About

Boilerplate to make a query in a corpus with Prevision Platform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published