• Stars
    star
    118
  • Rank 299,923 (Top 6 %)
  • Language
    TypeScript
  • License
    Apache License 2.0
  • Created over 1 year ago
  • Updated 6 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
523
star
3

fal

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

fal-swift

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

isolate

🛡️ Managed isolated environments for Python
Python
75
star
6

fal-js

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

awesome

List of awesome projects powered by fal.ai
44
star
8

text-to-image

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

dbt_feature_store

Build your feature store with macros right within your dbt repository
Python
37
star
10

stable-diffusion-benchmarks

Comparison of different stable diffusion implementations and optimizations
Python
36
star
11

fal-with-react-native

AI inference using fal.ai on a React Native app
TypeScript
28
star
12

interactive-3d-demo-app

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

dbt-cloud-action

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

fal_dbt_examples

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

lcm-websocket-demo

JavaScript
12
star
16

upscaler-battleground-demo-app

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

fal-java

A JVM-compatible, Java & Kotlin, client for the fal.ai model APIs
Java
10
star
18

chat-with-fal-app

TypeScript
8
star
19

fal-teller

An Apache Arrow native dynamic storage proxy layer for query engines.
Python
7
star
20

fal-dart

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

dbt-datafusion

Python
6
star
22

workflow-utils

Python
6
star
23

fal-nextjs-template

TypeScript
5
star
24

serverless-vscode

The VS Code extension for fal-serverless.
TypeScript
5
star
25

dbt_fal_ml_example

Jupyter Notebook
4
star
26

fal-bot

Python
4
star
27

fal_bike_example

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

dbt_feature_store_example

3
star
29

poe-fal-video-maker

A video maker Poe bot powered by fal.ai
Python
3
star
30

dbt_fal_ml_example2

Jupyter Notebook
2
star
31

tldraw-fal

TypeScript
2
star
32

zendesk_example

Python
1
star
33

fal-sagemaker-example

Example dbt project using fal and Sagemaker
Python
1
star
34

fal_dbt_test

Python
1
star
35

dbt-fal-serverless-demo

Python
1
star
36

fal-poe-bots

Python
1
star