Giter Site home page Giter Site logo

justaigithub / edit-anything-app Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fal-ai/edit-anything-app

0.0 0.0 0.0 182 KB

The source of the demo app for fal-serverless + Next.js

Home Page: https://editanything.ai

License: Apache License 2.0

JavaScript 2.15% Python 24.45% TypeScript 73.26% CSS 0.15%

edit-anything-app's Introduction

edit anything with fal serverless

This is a reference implementation of a Next.js and fal-serverless, to demonstrate how ML models running on serverless GPUs can be used within a web application using Next.js. You can also see a video about it here.

You can see a live demo on editanything.ai. In case you want to run the project yourself, follow the instructions below.

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

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Make sure you read our Code of Conduct
  2. Fork the project and clone your fork
  3. Setup the local environment with npm install
  4. Create a feature branch (git checkout -b feature/add-cool-thing) or a bugfix branch (git checkout -b fix/smash-that-bug)
  5. Commit the changes (git commit -m 'feat(client): added a cool thing') - use conventional commits
  6. Push to the branch (git push --set-upstream origin feature/add-cool-thing)
  7. Open a Pull Request

Check the good first issue queue, your contribution will be welcome!

License

Distributed under the Apache-2.0 License. See LICENSE for more information.

edit-anything-app's People

Contributors

drochetti avatar mederka avatar turbo1912 avatar chamini2 avatar burkaygur avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.