Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,11 +2,22 @@ import gradio as gr
|
|
2 |
import spaces
|
3 |
import random
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
import torch
|
6 |
from diffusers import FluxPipeline
|
7 |
from huggingface_hub.utils import RepositoryNotFoundError
|
8 |
|
9 |
-
pipeline = FluxPipeline.from_pretrained(
|
|
|
|
|
|
|
|
|
10 |
|
11 |
@spaces.GPU(duration=70)
|
12 |
def generate(prompt, negative_prompt, width, height, sample_steps, lora_id):
|
|
|
2 |
import spaces
|
3 |
import random
|
4 |
|
5 |
+
from huggingface_hub import login
|
6 |
+
import os
|
7 |
+
|
8 |
+
|
9 |
+
login(token=os.environ["HUGGINGFACE_HUB_TOKEN"])
|
10 |
+
|
11 |
+
|
12 |
import torch
|
13 |
from diffusers import FluxPipeline
|
14 |
from huggingface_hub.utils import RepositoryNotFoundError
|
15 |
|
16 |
+
pipeline = FluxPipeline.from_pretrained(
|
17 |
+
"black-forest-labs/FLUX.1-dev",
|
18 |
+
torch_dtype=torch.float16,
|
19 |
+
use_auth_token=True # This uses the environment token if not passed explicitly
|
20 |
+
).to("cuda")
|
21 |
|
22 |
@spaces.GPU(duration=70)
|
23 |
def generate(prompt, negative_prompt, width, height, sample_steps, lora_id):
|