Spaces:
Build error
Build error
Download util/lua/torch7json.lua from rawanessam/FloorPlanTransformation: direct link, hf CLI and curl.
- Browser
- Download file 610 Bytes
-
https://huggingface.co/spaces/rawanessam/FloorPlanTransformation/resolve/main/util/lua/torch7json.lua
- Command line
-
hf download hf://spaces/rawanessam/FloorPlanTransformation/util/lua/torch7json.lua
-
curl -L -o torch7json.lua https://huggingface.co/spaces/rawanessam/FloorPlanTransformation/resolve/main/util/lua/torch7json.lua
610 Bytes
| local cjson = require 'cjson' | |
| local pl = require 'pl.import_into'() | |
| local utils = require 'fbcode.deeplearning.experimental.yuandong.utils.utils' | |
| -- Save everything as a dictionary | |
| local opt = pl.lapp[[ | |
| -i,--input (default "") Input t7 file | |
| -o,--output (default "") Output json file | |
| ]] | |
| -- print("Input file = " .. opt.input) | |
| -- print("Output file = " .. opt.output) | |
| t = utils.convert_to_table(torch.load(opt.input)) | |
| if debug then print("encoding json") end | |
| s = cjson.encode(t) | |
| -- s = pl.pretty.write(t) | |
| f = assert(io.open(opt.output, "w")) | |
| f:write(s) | |
| -- save_to_json(t, f) | |
| f:close() | |