Skip to content

Commit

Permalink
remove graphicsmagick dep
Browse files Browse the repository at this point in the history
  • Loading branch information
benglard committed Sep 4, 2016
1 parent 54c9f66 commit 076aa54
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
7 changes: 4 additions & 3 deletions waffle-scm-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@ package = 'waffle'
version = 'scm-1'

source = {
url = 'git://github.com/christopher5106/waffle',
url = 'git://github.com/benglard/waffle',
}

description = {
summary = 'Fast, asynchronous web framework for Lua/Torch',
detailed = [[Waffle is a fast, asynchronous, express-inspired web framework for Lua/Torch]],
homepage = 'https://github.com/christopher5106/waffle'
homepage = 'https://github.com/benglard/waffle'
}

dependencies = {
'torch >= 7.0',
'paths >= 1.0',
'buffer',
'async',
'redis-async'
'redis-async',
'image'
}

build = {
Expand Down
1 change: 1 addition & 0 deletions waffle/init.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-- package
require 'xlua'
require 'image'

local ok, html = pcall(require, 'htmlua')
local msg = [[
Expand Down
19 changes: 5 additions & 14 deletions waffle/request.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
local async = require 'async'
local encodings = require 'waffle.encodings'
local gmOk, gm = pcall(require, 'image')
local afs = async.fs
local http_codes = async.http.codes

Expand Down Expand Up @@ -31,22 +30,14 @@ local _save = function(self, options, cb)
end)
end

local _totensor = function(self, ...)
if gmOk then
local data = torch.ByteTensor(torch.ByteStorage():string(self.data))
local ok, img = pcall(image.decompress, data)
if ok then
return img
else
return nil
end
else
return nil
end
local _totensor = function(self)
return torch.ByteTensor(torch.ByteStorage():string(self.data))
end

local _toimage = function(self)
return _totensor(self, 'float','RGB','DHW')
local data = _totensor(self)
local ok, img = pcall(image.decompress, data)
if ok then return img else return nil end
end

local _getform = function(self)
Expand Down

0 comments on commit 076aa54

Please sign in to comment.