Comparing version 1.0.0 to 1.0.1
@@ -8,2 +8,5 @@ 'use strict'; | ||
const apiBaseUrl = require('./apiBaseUrl').baseUrl; | ||
const resultRendering = require('./resultRendering'); | ||
const globalObject = Function('return this')(); | ||
@@ -27,3 +30,3 @@ | ||
function urlForModel(model_name) { | ||
return "https://api.deepai.org/api/" + model_name; | ||
return apiBaseUrl+"/api/" + model_name; | ||
} | ||
@@ -33,5 +36,2 @@ | ||
DeepAI.prototype.callStandardApi = async function request(model_name, inputs_object) { | ||
if (!this.apiKey) { | ||
throw new Error("DeepAI error: apiKey should be first set with deepai.setApiKey(...)"); | ||
} | ||
@@ -85,3 +85,5 @@ const form = new formData(); | ||
var req_options = {}; | ||
var req_options = { | ||
withCredentials: true | ||
}; | ||
if (form.getHeaders !== undefined) { | ||
@@ -96,2 +98,4 @@ // formData is the nodejs based subsitute, only needed for node.js | ||
DeepAI.prototype.renderResultIntoElement = resultRendering.renderResultIntoElement; | ||
module.exports = DeepAI; |
{ | ||
"name": "deepai", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"license": "BSD-2-Clause", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -62,2 +62,20 @@ # DeepAI JS Client | ||
``` | ||
##### Browser Result Rendering | ||
This code will render the result of the API call into an existing HTML element, such as a div, with the id "yourResultContainerId". | ||
The result will fit itself inside your container, so be sure to set a size on it. | ||
```js | ||
var result = await deepai.callStandardApi("content-moderation", { | ||
image: "https://YOUR_IMAGE_URL" | ||
}); | ||
await deepai.renderResultIntoElement(result, document.getElementById('yourResultContainerId')); | ||
``` | ||
#### Node.js | ||
@@ -64,0 +82,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2470323
19
13046
120
5