Before You Start
You’ll need:- Python - we recommend 3.11
- A fal account (sign up is free)
- Basic familiarity with Python and AI models
Step 1: Install the CLI
If you haven’t already:Step 2: Authenticate
Get your API key from the fal dashboard and authenticate:Step 3: Create Your Image Generator
Create a file calledimage_generator.py
with this Stable Diffusion XL text-to-image model:
Step 4: Test Your Image Generator
First, run your model locally to test it:- Starts your AI image generation app as a service
- Downloads and loads the Stable Diffusion XL model (cached after first run)
- Provides two URLs for interaction: a direct HTTP proxy and a web playground
- Allows you to test your app without authentication while
fal run
is active
Step 5: Deploy Your Model (Optional)
Once you’re satisfied, deploy it to create a persistent URL for your model:- Deploys your model as a serverless app on GPU instances
- Makes your app available for requests, with runners managed automatically based on demand and scaling configuration (see scaling to learn more)
- Returns a unique persistent URL for your deployed model
What Just Happened?
🎉 Congratulations! You’ve successfully:- Created an AI model: Built a Stable Diffusion XL image generator
- Tested locally: Ran your model and generated an image from a text prompt
- Deployed to the cloud: Made your model accessible via REST API (if you chose to deploy)
Next Steps
Now that you have a working model, you can:- Learn core concepts - Understand models, endpoints, and scaling
- Follow a complete tutorial - Build a more sophisticated model
- Explore other tutorials - Deploy text-to-video, text-to-speech, and more