Skip to main content

Server for the Image Source app (available on Expo). Image Source helps send images, get predictions on images and train image models.

Project description

image_source_server

Server for Image Source app

Usage

  1. Install Flask if you haven't already (Flask comes preinstalled if you have Anaconda)
pip install Flask
  1. Install image_source_server.
pip install image_source_server
  1. Create an ImageSourceServer object, implement the "train" and "predict" methods and pass it into the ImageSourceServer constructor (example shown below)
from image_source_server import ImageSourceServer

def train(train_dir_uri, params):
    print('Training on data from : ' + train_dir_uri)
    print('Train params : ' + str(params))
    return 'Trained' # return value is returned to the Image Source App in the HTTP Response

def predict(img_uri):
    print('Predicting on ' + img_uri)
    return 'Cat'  # return value is returned to the Image Source App in the HTTP Response

serv = ImageSourceServer(train=train, predict=predict)
serv.run()
  • "train" method will be called with the uri of the folder containing the training images when "Train" button is pressed on the app.
train(train_dir_uri, params)
    train_dir_uri - uri of the directory containing folders which in turn contain the images
    params - training parameters (list of key-value pairs) passed from the Image Source app
  • "predict" method will be called with the uri of the image provided by the app for prediction. The value returned by the predict method will be returned to the app and displayed as an alert to the user.
predict(image_uri)
    image_uri - the uri of the image on which the prediction needs to be made
    return value - will be converted to a string (if not already a string) and sent to the Image Source app. This string will be displayed as an alert to the user
  • "serv.run()" starts the server
  1. Install the Expo app. Play Store Link (Although there is an Expo app for iOS, Apple doesn't allow for other apps to be run on the Expo app. An iOS stand alone Image Source app release is planned in future.)
  2. Visit Image Source app page on expo. Scan the QR code on your Expo android app to open the Image Source app.
  3. Run the server script (and make sure you've called the "run" method)

Configure the app to work with server

  1. Go to "Settings" tab on the Image Source app.
  2. Click on "Add" button.
  3. Next to the "Host" entry, enter your SERVER'S IP ADDRESS(Example: 192.168.1.130 ).
  4. Next to the "Port" entry, enter your SERVER'S PORT NUMBER. By default, image source server runs on port 12221. So, if you haven't passed in an argument in the the ImageSourceServer constructor to specify a custom port, enter 12221 here.
  5. Click "Save".
  6. The Image Source app is now configured to send the data to the specified server. You may add other servers too (but one server is mandatory).

Curating and sending data

  1. Click on "Select Image" and select the image and it's category.
  2. Click on "Submit" to add the image to the app.
  3. When the pics need to be transfered to server, click on "Send all images to server". This transfers all images to server. You may then check 'data/images' directory on the folder where the server was run to check for the received pics.

Training

  1. Go to "Train" tab on the Image Source app.
  2. Click on "Add Parameter" to add training parameters. Training parameters are key value pairs. All the key value pairs will be sent to the server which will then pass it to the "train" method.
  3. Click on the "Train" button to start training.

Prediction

  1. Go to "Predict" tab on the Image Source app.
  2. Select the image to be sent to server for prediction.
  3. Click on "Submit"
  4. The image will be sent to server and the prediction will be displayed as an alert once the server responds.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

image_source_server-1.0.1.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

image_source_server-1.0.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file image_source_server-1.0.1.tar.gz.

File metadata

  • Download URL: image_source_server-1.0.1.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.6

File hashes

Hashes for image_source_server-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ac1be1ac8145c511b214ba23ba12c59b533c1ddc6806b0f9bc77bf7d31fd9433
MD5 9855d35c1f0f7df9de98d9f7e3c6efc7
BLAKE2b-256 ca31714e3dd6eae350bc2d9d3473ff5c2c48a96846764a089b7983b9218bd871

See more details on using hashes here.

File details

Details for the file image_source_server-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: image_source_server-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.6

File hashes

Hashes for image_source_server-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 08b3110074b6a405f8832130244d643af68a0f4b425ebc81d66362a089e105e4
MD5 378905655469ec1c514bf1e81f359361
BLAKE2b-256 f941aa52c336d3fcebf048683b5a2eddfab1f30fe15fc0e9023c5064fd83a9cc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page