Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

roboflow

Package Overview
Dependencies
Maintainers
9
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

roboflow - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

__tests__/api.tests.js

48

api.js

@@ -205,2 +205,48 @@ const config = require("./config.js");

async function embedImage(filepath, apiKey) {
const image = fs.readFileSync(filepath, {
encoding: "base64"
});
const response = await axios({
method: "POST",
url: `${config.get("RF_CLIP_URL")}/embed_image`,
params: {
api_key: apiKey
},
data: {
clip_version_id: "ViT-B-16",
image: [
{
type: "base64",
value: image
}
]
},
headers: {
"Content-Type": "application/json"
}
});
return response.data;
}
async function embedText(text, apiKey) {
const response = await axios({
method: "POST",
url: `${config.get("RF_CLIP_URL")}/embed_text`,
params: {
api_key: apiKey
},
data: {
clip_version_id: "ViT-B-16",
text: text
},
headers: {
"Content-Type": "application/json"
}
});
return response.data;
}
module.exports = api = {

@@ -217,3 +263,5 @@ getWorkspace,

semanticSegmentation,
embedImage,
embedText,
uploadAnnotationRaw
};

7

config.js

@@ -15,3 +15,4 @@ const Conf = require("conf");

RF_INSTANCE_SEGMENTATION_URL: "https://outline.roboflow.com",
RF_SEMANTIC_SEGMENTATION_URL: "https://segment.roboflow.com"
RF_SEMANTIC_SEGMENTATION_URL: "https://segment.roboflow.com",
RF_CLIP_URL: "https://infer.roboflow.com/clip"
};

@@ -60,2 +61,6 @@

"https://segment.roboflow.com"
),
RF_CLIP_URL: getCascadingConfigValue(
"RF_CLIP_URL",
"https://infer.roboflow.com/clip"
)

@@ -62,0 +67,0 @@ };

13

package.json
{
"name": "roboflow",
"version": "0.1.0",
"version": "0.2.0",
"description": "Roboflow.com node module",

@@ -11,6 +11,6 @@ "main": "index.js",

"type": "git",
"url": "git+https://github.com/roboflow-ai/roboflow-node.git"
"url": "git+https://github.com/roboflow/roboflow-node.git"
},
"dependencies": {
"axios": "^0.27.2",
"axios": "^0.27.2",
"conf": "^10.2.0",

@@ -21,3 +21,4 @@ "form-data": "^4.0.0",

"devDependencies": {
"jest": "^29.2.2",
"dotenv": "^16.3.1",
"jest": "^29.6.1",
"prettier": "^2.7.1"

@@ -34,5 +35,5 @@ },

"bugs": {
"url": "https://github.com/roboflow-ai/roboflow-node/issues"
"url": "https://github.com/roboflow/roboflow-node/issues"
},
"homepage": "https://github.com/roboflow-ai/roboflow-node#readme"
"homepage": "https://github.com/roboflow/roboflow-node#readme"
}
# Roboflow node library
Roboflow makes computer vision accessible to all developers.
[https://roboflow.ai](https://roboflow.ai)
[https://roboflow.com](https://roboflow.com)

@@ -30,1 +30,12 @@ **This project is under active development, use at your own risk**

- `semanticSegmentation(filepath, modelUrl, apiKey)`
- `embedImage(filepath, apiKey)`
- `embedText(text, apiKey)`
## Development
### Testing
The repo includes a series of `jest` tests to make sure the api wrapper functions work as expected. To run the tests you must setup a `.env` file with the following variables and run `npm run test`:
- `apiKey` a valid roboflow api key
- `workspace` a valid roboflow workspace which can be accessed with the given `apiKey`
- `project` a valid roboflow project within the given `workspace`
- `version` a valid version of the given roboflow project which has a model trained
- `testImage` the relative path to a test image inside the `__tests__` directory such as `test.jpeg`
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc