Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,14 +2,17 @@ import gradio as gr
|
|
| 2 |
import torch
|
| 3 |
import spaces
|
| 4 |
from diffusers import FluxPipeline
|
|
|
|
| 5 |
|
| 6 |
# 1. Initialize the Pipeline
|
|
|
|
| 7 |
model_id = "black-forest-labs/FLUX.1-schnell"
|
| 8 |
|
| 9 |
# Load the model with bfloat16 to save memory and improve speed
|
| 10 |
pipe = FluxPipeline.from_pretrained(
|
| 11 |
model_id,
|
| 12 |
torch_dtype=torch.bfloat16
|
|
|
|
| 13 |
)
|
| 14 |
|
| 15 |
# 2. Define the Generation Function with ZeroGPU decorator
|
|
|
|
| 2 |
import torch
|
| 3 |
import spaces
|
| 4 |
from diffusers import FluxPipeline
|
| 5 |
+
import os
|
| 6 |
|
| 7 |
# 1. Initialize the Pipeline
|
| 8 |
+
hf_token = os.getenv("HF_TOKEN")
|
| 9 |
model_id = "black-forest-labs/FLUX.1-schnell"
|
| 10 |
|
| 11 |
# Load the model with bfloat16 to save memory and improve speed
|
| 12 |
pipe = FluxPipeline.from_pretrained(
|
| 13 |
model_id,
|
| 14 |
torch_dtype=torch.bfloat16
|
| 15 |
+
hf_token = os.getenv("FLUX_API_TOKEN")
|
| 16 |
)
|
| 17 |
|
| 18 |
# 2. Define the Generation Function with ZeroGPU decorator
|