cloud-vision-flows

Crates.iocloud-vision-flows
lib.rscloud-vision-flows
version0.1.1
sourcesrc
created_at2023-04-10 01:34:09.059225
updated_at2023-04-10 02:37:22.558398
descriptionGoogle Cloud Vision integration for flows.network
homepage
repository
max_upload_size
id834645
size6,829
DarumaDocker!! (DarumaDocker)

documentation

https://docs.rs/cloud-vision-flows

README

This is a library for using Cloud Vision in your flow function for flows.network.

Usage example

use cloud_vision_flows::text_detection;
use lambda_flows::{request_received, send_response};

#[no_mangle]
pub fn run() {
    request_received(|_qry, body| {
        let text = text_detection(String::from_utf8(body).unwrap());
        match text {
            Ok(r) => send_response(
                200,
                vec![(
                    String::from("content-type"),
                    String::from("text/plain; charset=UTF-8"),
                )],
                r.as_bytes().to_vec(),
            ),
            Err(e) => send_response(
                500,
                vec![(
                    String::from("content-type"),
                    String::from("text/plain; charset=UTF-8"),
                )],
                e.as_bytes().to_vec(),
            ),
        }
    });
}

The raw body of the request of this lambda function will be passed to text_detection then the function respond with the detected text.

The whole document is here.

Commit count: 0

cargo fmt