Skip to content

ninjasaid2k/edit-anything-app

 
 

Repository files navigation

edit anything with fal serverless

Getting started

Prerequisites

  • Python >=3.8
  • Node.js >= 18.0

Install fal-serverless and authenticate

pip install fal-serverless

After installation is complete, you can authenticate:

fal-serverless auth login

Install next.js dependencies

npm install

Generate authentication keys and set them as environment variables

Generate a secret key for key-based authentication

fal-serverless key generate

Set the generated key ID and secret as environment variables:

export FAL_KEY_ID="your-key-id" FAL_KEY_SECRET="your-key-secret"

Set Google Cloud Service Account secret

The web endpoint uses Google Cloud Storage for saving the inference results. So it needs access to a service account json. You can provide it to fal-serverless like this:

fal-serverless secrets set GCLOUD_SA_JSON "$(cat path-to-my-service-account.json)"

Deploy the edit_image and make_masks functions as a web endpoints

fal-serverless function serve serverless/app.py edit_image --alias edit_image
fal-serverless function serve serverless/app.py make_masks --alias make_masks

And set the provided URL as an environment variable:

export MASK_FUNCTION_URL=your_mask_endpoint_url EDIT_FUNCTION_URL=your_edit_endpoint_url

You can also set these in .env.local file:

FAL_KEY_ID=key_id_value
FAL_KEY_SECRET=key_secret_value
MASK_FUNCTION_URL=mask_endpoint_url
EDIT_FUNCTION_URL=edit_endpoint_url

Start the local dev server

npm run dev

TODO:

  • Build UI app with Next.js
  • Automated deployment

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 71.5%
  • Python 26.0%
  • JavaScript 2.3%
  • CSS 0.2%