func loadConfiguration()

in HuggingSnap/Views/VLMEvaluator.swift [76:86]


    func loadConfiguration(hub: HubApi) async throws -> HuggingSnapModelConfiguration {
        let filename = "config.json"
        let downloadedTo = try await hub.snapshot(from: HuggingSnapModelConfiguration.configurationRepo, matching: filename)
        let jsonURL = downloadedTo.appendingPathComponent(filename)
        let config = try JSONDecoder().decode(HuggingSnapModelConfiguration.self, from: try Data(contentsOf: jsonURL))

        // FIXME: remove this when we upgrade to swift-transformers with cache invalidation
        try? FileManager().removeItem(at: downloadedTo)

        return config
    }