Skip to main content

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.

Release files for image-source-server 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for image-source-server 1.0.1
File Size Uploaded
image_source_server-1.0.1.tar.gz 3.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for image-source-server 1.0.1
File Interpreter ABI Platform
image_source_server-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.3 kB

Release files / image_source_server-1.0.1.tar.gz

Download URL image_source_server-1.0.1.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ac1be1ac8145c511b214ba23ba12c59b533c1ddc6806b0f9bc77bf7d31fd9433
BLAKE2b-256 checksum
How to use checksums
ca31714e3dd6eae350bc2d9d3473ff5c2c48a96846764a089b7983b9218bd871
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / image_source_server-1.0.1-py3-none-any.whl

Download URL image_source_server-1.0.1-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
08b3110074b6a405f8832130244d643af68a0f4b425ebc81d66362a089e105e4
BLAKE2b-256 checksum
How to use checksums
f941aa52c336d3fcebf048683b5a2eddfab1f30fe15fc0e9023c5064fd83a9cc
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page