Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
expo-stable-diffusion
Advanced tools
Run Stable Diffusion using Core ML on iOS & iPadOS within your Expo & React Native App
❗️
expo-stable-diffusion
currently only works on iOS due to the platform's ability to run Stable Diffusion models on Apple Neural Engine!
Start by installing the expo-stable-diffusion
module into your Expo managed project:
npx expo install expo-stable-diffusion
In order for the project to build successfully, you have to set the iOS Deployment Target to 16.2
. You can achieve this by installing the expo-build-properties
plugin:
npx expo install expo-build-properties
Configure the plugin by adding the following to your app.json
:
{
"expo": {
"plugins": [
[
"expo-build-properties",
{
"ios": {
"deploymentTarget": "16.2"
}
}
]
]
}
}
To prevent memory issues, add the Increased Memory Limit capability to your iOS project. Add the following to your app.json
:
{
"expo": {
"ios": {
"entitlements": {
"com.apple.developer.kernel.increased-memory-limit": true
}
}
}
}
npx expo prebuild --clean --platform ios
npx expo run:ios
After installation and configuration, you can start generating images using expo-stable-diffusion
. Here's a basic example:
import * as FileSystem from 'expo-file-system';
import * as ExpoStableDiffusion from 'expo-stable-diffusion';
const MODEL_PATH = FileSystem.documentDirectory + 'Model/stable-diffusion-2-1';
const SAVE_PATH = FileSystem.cacheDirectory + 'GeneratedImages/image.jpeg';
await ExpoStableDiffusion.loadModel(MODEL_PATH);
await ExpoStableDiffusion.generateImage({
prompt: 'A cat coding at night',
stepCount: 25,
savePath: SAVE_PATH,
});
To use the expo-stable-diffusion
module, you need a converted Core ML Stable Diffusion model. You can convert your own model using Apple's official guide or download pre-converted models from Apple's Hugging Face repository or my Hugging Face repository.
❗️ The model load time and image generation duration take some time, especially on devices with lower RAM than 6GB! Find more information in Q6 in the FAQ section of the ml-stable-diffusion repo.
FAQs
Run Stable Diffusion using Core ML on iOS & iPadOS within your Expo & React Native App
The npm package expo-stable-diffusion receives a total of 9 weekly downloads. As such, expo-stable-diffusion popularity was classified as not popular.
We found that expo-stable-diffusion demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.