• Stars
    star
    107
  • Rank 313,934 (Top 7 %)
  • Language
    TypeScript
  • License
    Apache License 2.0
  • Created about 1 year ago
  • Updated 12 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

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 the Google Cloud Storage bucket name as a secret

The serverless function writes it's results to a GCS bucket.

fal-serverless secrets set GCLOUD_BUCKET_NAME "your-bucket-name"

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 as web endpoints

fal-serverless function serve serverless/app.py app --alias edit_anything_app

And set the provided URL as an environment variable:

export MASK_FUNCTION_URL=`your_app_endpoint_url`/masks EDIT_FUNCTION_URL=`your_app_endpoint_url`/edit

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.

More Repositories

1

dbt-fal

do more with dbt. dbt-fal helps you run Python alongside dbt, so you can send Slack alerts, detect anomalies and build machine learning models.
Python
851
star
2

sdxl-lightning-demo-app

A demo application using fal.realtime and the lightning fast SDXL API provided by fal
JavaScript
503
star
3

fal

⚡ Fastest way to serve open source ML models to millions
Python
182
star
4

fal-swift

Swift client for the fal.ai model APIs
Swift
149
star
5

isolate

🛡️ Managed isolated environments for Python
Python
70
star
6

fal-js

The JavaScript client and utilities to fal-serverless with built-in TypeScript definitions
TypeScript
55
star
7

text-to-image

A single API for text-to-image, built on fal that supports all Stable Diffusion variants
Python
42
star
8

dbt_feature_store

Build your feature store with macros right within your dbt repository
Python
36
star
9

stable-diffusion-benchmarks

Comparison of different stable diffusion implementations and optimizations
Python
28
star
10

fal-with-react-native

AI inference using fal.ai on a React Native app
TypeScript
25
star
11

dbt-cloud-action

This action lets you trigger a job run on dbt Cloud.
JavaScript
23
star
12

interactive-3d-demo-app

Interactive 3d demo of 3d and image AI inference provided by fal.ai
TypeScript
20
star
13

fal_dbt_examples

Examples showing real-life use cases for fal + dbt
Jupyter Notebook
17
star
14

lcm-websocket-demo

JavaScript
12
star
15

upscaler-battleground-demo-app

Upscaler demo app showing the different available upscaling models served by fal.ai
TypeScript
8
star
16

dbt-datafusion

Python
6
star
17

chat-with-fal-app

TypeScript
6
star
18

fal-teller

An Apache Arrow native dynamic storage proxy layer for query engines.
Python
6
star
19

workflow-utils

Python
6
star
20

fal-dart

The fal.ai serverless client for Dart and Flutter
Dart
5
star
21

dbt_fal_ml_example

Jupyter Notebook
4
star
22

serverless-vscode

The VS Code extension for fal-serverless.
TypeScript
4
star
23

fal-bot

Python
3
star
24

fal_bike_example

Example of using the dbt-cloud-action to run with fal run in GH Actions
Python
3
star
25

fal-kotlin

Kotlin client for the fal.ai model APIs
Kotlin
3
star
26

dbt_fal_ml_example2

Jupyter Notebook
2
star
27

tldraw-fal

TypeScript
2
star
28

zendesk_example

Python
1
star
29

fal-sagemaker-example

Example dbt project using fal and Sagemaker
Python
1
star
30

fal_dbt_test

Python
1
star
31

dbt-fal-serverless-demo

Python
1
star
32

poe-fal-video-maker

A video maker Poe bot powered by fal.ai
Python
1
star
33

dbt_feature_store_example

1
star
34

fal-poe-bots

Python
1
star
35

fal-nextjs-template

TypeScript
1
star