Background Remover is a SvelteKit app that uses Appwrite Cloud and Azure AI to remove the background from your headshots (and other images).
- Removes background from your picture
- Register via email or login as guest
- Saves images to your profile (for logged in users)
- Allows viewing (and sharing) of picture links (for logged in users)
There are some necessary steps to get the project up and running.
- Create an Azure account
- Create a Computer Vision resource from the Azure Marketplace.
Keep the endpoint and API key stored with you for later.
- Create an account on Appwrite Cloud (or sign in if you have one)
- Create a project and add your web app (URL)
- Adding the exact URL is necessary for the reset password link functionality
- Create an API key with
user.read
,user.write
,documents.read
,documents.write
,files.read
, andfiles.write
scopes
Keep the project ID and API key stored with you for later.
- Create two buckets, one for input images and one for output images
Keep both your bucket Ids stored with you for later.
- Create a database with one collection, containing the following attributes
Key | Type | Size | Required |
---|---|---|---|
userId | string | 255 | Yes |
fileId | string | 255 | Yes |
Keep the database Id and collection Id stored with you for later.
- Change the branch (Git) to
appwrite-functions
to find the Appwrite function that helps in deleting accounts - Update the project name and project id in the
appwrite.json
file, if you kept them different - Deploy the function from the
functions/Delete Account
directory, following the configuration details in the function's Readme - Setup the function's environment variables as mentioned in the function's Readme
Keep the function Id stored with you for later.
Rename the .env.example
file to .env
and add all the necessary environment variables.
VITE_APP_URL
: URL of the app with protocol (e.g.: https://bgremover.in)PUBLIC_APPWRITE_COLLECTION_ID
: Collection Id from AppwritePUBLIC_APPWRITE_DATABASE_ID
: Database Id from AppwritePUBLIC_APPWRITE_PROJECT_ID
: Project Id from AppwritePUBLIC_APPWRITE_OUTPUT_IMAGES_BUCKET_ID
: Output images bucket Id from AppwritePUBLIC_APPWRITE_INPUT_IMAGES_BUCKET_ID
: Input images bucket Id from AppwritePUBLIC_APPWRITE_DELETE_ACCOUNT_FUNCTION_ID
: Delete account function Id from AppwriteSECRET_VISION_ENDPOINT
: Azure AI Vision endpointSECRET_VISION_KEY
: Azure AI Vision API Key
The svelte.config.js
file is currently configured for Vercel since that is where the application is deployed and a custom timeout is configured for server actions.
- Install
@sveltejs/adapter-auto
using npm/pnpm/yarn - Replace all the code in the
svelte.config.js
file with the following:
import adapter from '@sveltejs/adapter-auto';
import { preprocessMeltUI } from '@melt-ui/pp';
import { vitePreprocess } from '@sveltejs/kit/vite';
import sequence from 'svelte-sequential-preprocessor';
/** @type {import('@sveltejs/kit').Config} */
const config = {
preprocess: sequence([
vitePreprocess(),
preprocessMeltUI()
])
};
export default config;
After deploying, make sure to update the final URL in the
VITE_APP_URL
environment variable