Sha256: 9b083dc56ff1b77530c129626c3dc3532e9a28e8cb1b9175fce6b2b9ba99f9e8

Contents?: true

Size: 425 Bytes

Versions: 6

Compression:

Stored size: 425 Bytes

Contents

require "sinatra"
require "sinatra/reloader"
require "json"
require "base64"
require_relative "mnist_predict"

get "/" do
  erb :index
end

post "/predict" do
  json = request.body.read
  params = JSON.parse(json, symbolize_names: true)
  img = Base64.decode64(params[:img])
  width = params[:width].to_i
  height = params[:height].to_i
  result = mnist_predict(img, width, height)
  JSON.dump(result)
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby-dnn-1.3.0 examples/judge-number/server.rb
ruby-dnn-1.2.3 examples/judge-number/server.rb
ruby-dnn-1.2.2 examples/judge-number/server.rb
ruby-dnn-1.2.1 examples/judge-number/server.rb
ruby-dnn-1.2.0 examples/judge-number/server.rb
ruby-dnn-1.1.6 examples/judge-number/server.rb