Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import spaces # Import this first to avoid CUDA initialization issues
|
2 |
import gradio as gr
|
3 |
import json
|
@@ -6,9 +7,8 @@ import random
|
|
6 |
import time
|
7 |
from PIL import Image
|
8 |
from diffusers import DiffusionPipeline
|
9 |
-
import os
|
10 |
|
11 |
-
#
|
12 |
hf_token = os.getenv('waffles')
|
13 |
|
14 |
# Load LoRAs from JSON file
|
@@ -17,7 +17,11 @@ with open('loras.json', 'r') as f:
|
|
17 |
|
18 |
# Initialize the base model with authentication
|
19 |
base_model = "black-forest-labs/FLUX.1-dev"
|
20 |
-
pipe = DiffusionPipeline.from_pretrained(
|
|
|
|
|
|
|
|
|
21 |
|
22 |
MAX_SEED = 2**32-1
|
23 |
|
|
|
1 |
+
import os
|
2 |
import spaces # Import this first to avoid CUDA initialization issues
|
3 |
import gradio as gr
|
4 |
import json
|
|
|
7 |
import time
|
8 |
from PIL import Image
|
9 |
from diffusers import DiffusionPipeline
|
|
|
10 |
|
11 |
+
# Use the 'waffles' environment variable as the access token
|
12 |
hf_token = os.getenv('waffles')
|
13 |
|
14 |
# Load LoRAs from JSON file
|
|
|
17 |
|
18 |
# Initialize the base model with authentication
|
19 |
base_model = "black-forest-labs/FLUX.1-dev"
|
20 |
+
pipe = DiffusionPipeline.from_pretrained(
|
21 |
+
base_model,
|
22 |
+
torch_dtype=torch.bfloat16,
|
23 |
+
use_auth_token=hf_token # Use the 'waffles' token
|
24 |
+
)
|
25 |
|
26 |
MAX_SEED = 2**32-1
|
27 |
|