Spaces:
Running on Zero
Running on Zero
Commit ·
3ffc33c
1
Parent(s): 09f7c6b
add torchvision to requirement
Browse files
app.py
CHANGED
|
@@ -11,10 +11,10 @@ from src.attention_processor import FluxBlendedAttnProcessor2_0
|
|
| 11 |
from src.utils_sample import set_seed, resize_and_add_margin
|
| 12 |
import os
|
| 13 |
|
| 14 |
-
|
| 15 |
dtype = torch.bfloat16
|
| 16 |
token = os.environ.get("HF_TOKEN")
|
| 17 |
-
|
| 18 |
pipe = FluxPipeline.from_pretrained(
|
| 19 |
"black-forest-labs/FLUX.1-dev",
|
| 20 |
torch_dtype=dtype,
|
|
@@ -23,7 +23,7 @@ pipe = FluxPipeline.from_pretrained(
|
|
| 23 |
pipe = pipe.to("cuda")
|
| 24 |
|
| 25 |
@spaces.GPU
|
| 26 |
-
def process_image_and_text(image, scale, seed, text
|
| 27 |
set_seed(seed)
|
| 28 |
blended_attn_procs = {}
|
| 29 |
for name, _ in pipe.transformer.attn_processors.items():
|
|
@@ -143,7 +143,7 @@ header = """
|
|
| 143 |
"""
|
| 144 |
|
| 145 |
|
| 146 |
-
def create_app(
|
| 147 |
|
| 148 |
with gr.Blocks() as app:
|
| 149 |
gr.Markdown(header, elem_id="header")
|
|
@@ -184,4 +184,4 @@ def create_app(pipe):
|
|
| 184 |
|
| 185 |
|
| 186 |
if __name__ == "__main__":
|
| 187 |
-
create_app(
|
|
|
|
| 11 |
from src.utils_sample import set_seed, resize_and_add_margin
|
| 12 |
import os
|
| 13 |
|
| 14 |
+
pipe = None
|
| 15 |
dtype = torch.bfloat16
|
| 16 |
token = os.environ.get("HF_TOKEN")
|
| 17 |
+
|
| 18 |
pipe = FluxPipeline.from_pretrained(
|
| 19 |
"black-forest-labs/FLUX.1-dev",
|
| 20 |
torch_dtype=dtype,
|
|
|
|
| 23 |
pipe = pipe.to("cuda")
|
| 24 |
|
| 25 |
@spaces.GPU
|
| 26 |
+
def process_image_and_text(image, scale, seed, text):
|
| 27 |
set_seed(seed)
|
| 28 |
blended_attn_procs = {}
|
| 29 |
for name, _ in pipe.transformer.attn_processors.items():
|
|
|
|
| 143 |
"""
|
| 144 |
|
| 145 |
|
| 146 |
+
def create_app():
|
| 147 |
|
| 148 |
with gr.Blocks() as app:
|
| 149 |
gr.Markdown(header, elem_id="header")
|
|
|
|
| 184 |
|
| 185 |
|
| 186 |
if __name__ == "__main__":
|
| 187 |
+
create_app().launch(debug=True, ssr_mode=False)
|