require "replicate" require "base64" require "pry" Replicate.configure do |config| config.api_token = "r8_HD5VtCokZJGOtOCcAEELkbobSTGrzYd3alWPF" end model = Replicate.client.retrieve_model("tencentarc/gfpgan") version = model.latest_version Dir.glob("thogun/data/*.jpg") do |image| base64_image = Base64.encode64(image) base64_image_url = "data:image/png;base64,#{base64_image}" inputs = { img: base64_image, version: "v1.4", scale: 2 } binding.pry output = version.predict(inputs) end # gem install --user-install specific_install # gem git_install --user-install https://github.com/replicate/replicate-ruby.git