Handler for the "classify" request type
| 166 | |
| 167 | // Handler for the "classify" request type |
| 168 | auto handle_classify_request(http_request const & req) -> ex::sender auto |
| 169 | { |
| 170 | return |
| 171 | // start with the input buffer |
| 172 | ex::just(req) |
| 173 | // extract the image from the input request |
| 174 | | ex::then(extract_image) |
| 175 | // analyze the content of the image and classify it |
| 176 | // we are doing the processing on the same thread |
| 177 | | ex::then(do_classify) |
| 178 | // handle errors |
| 179 | | ex::upon_error(on_classification_error) |
| 180 | // handle cancellation |
| 181 | | ex::upon_stopped(on_classification_cancelled) |
| 182 | // transform this into a response |
| 183 | | ex::then(to_response) |
| 184 | // done |
| 185 | ; |
| 186 | } |
| 187 | |
| 188 | auto main() -> int |
| 189 | { |