Spaces:
Running
on
Zero
Running
on
Zero
Apply the real weights
#1
by
multimodalart
HF Staff
- opened
- app.py +6 -15
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -1,15 +1,6 @@
|
|
| 1 |
import os
|
| 2 |
import subprocess
|
| 3 |
import sys
|
| 4 |
-
|
| 5 |
-
subprocess.run([sys.executable, "-m", "pip", "uninstall", "-y", "diffusers"], check=False)
|
| 6 |
-
subprocess.check_call(["unzip", "-o", "diffusers.zip", "-d", "diffusers_local"])
|
| 7 |
-
subprocess.check_call([sys.executable, "-m", "pip", "install", "--no-cache-dir", "./diffusers_local"])
|
| 8 |
-
|
| 9 |
-
subprocess.check_call(["pwd"])
|
| 10 |
-
subprocess.check_call(["ls", "-la"])
|
| 11 |
-
|
| 12 |
-
|
| 13 |
import io
|
| 14 |
import gradio as gr
|
| 15 |
import numpy as np
|
|
@@ -57,8 +48,8 @@ Rules:
|
|
| 57 |
Output only the final instruction in plain text and nothing else."""
|
| 58 |
|
| 59 |
# Model repository IDs for 9B
|
| 60 |
-
REPO_ID_REGULAR = "
|
| 61 |
-
REPO_ID_DISTILLED = "
|
| 62 |
|
| 63 |
# Load both 9B models
|
| 64 |
print("Loading 9B Regular model...")
|
|
@@ -72,18 +63,18 @@ pipe_distilled.to("cuda")
|
|
| 72 |
# Dictionary for easy access
|
| 73 |
pipes = {
|
| 74 |
"Distilled (4 steps)": pipe_distilled,
|
| 75 |
-
"
|
| 76 |
}
|
| 77 |
|
| 78 |
# Default steps for each mode
|
| 79 |
DEFAULT_STEPS = {
|
| 80 |
"Distilled (4 steps)": 4,
|
| 81 |
-
"
|
| 82 |
}
|
| 83 |
|
| 84 |
DEFAULT_CFG = {
|
| 85 |
"Distilled (4 steps)": 1.0,
|
| 86 |
-
"
|
| 87 |
}
|
| 88 |
|
| 89 |
def image_to_data_uri(img):
|
|
@@ -266,7 +257,7 @@ FLUX.2 [Klein] is a distilled model capable of generating, editing and combining
|
|
| 266 |
|
| 267 |
mode_choice = gr.Radio(
|
| 268 |
label="Mode",
|
| 269 |
-
choices=["Distilled (4 steps)", "
|
| 270 |
value="Distilled (4 steps)",
|
| 271 |
)
|
| 272 |
|
|
|
|
| 1 |
import os
|
| 2 |
import subprocess
|
| 3 |
import sys
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
import io
|
| 5 |
import gradio as gr
|
| 6 |
import numpy as np
|
|
|
|
| 48 |
Output only the final instruction in plain text and nothing else."""
|
| 49 |
|
| 50 |
# Model repository IDs for 9B
|
| 51 |
+
REPO_ID_REGULAR = "black-forest-labs/FLUX.2-klein-base-9B"
|
| 52 |
+
REPO_ID_DISTILLED = "black-forest-labs/FLUX.2-klein-9B"
|
| 53 |
|
| 54 |
# Load both 9B models
|
| 55 |
print("Loading 9B Regular model...")
|
|
|
|
| 63 |
# Dictionary for easy access
|
| 64 |
pipes = {
|
| 65 |
"Distilled (4 steps)": pipe_distilled,
|
| 66 |
+
"Base (50 steps)": pipe_regular,
|
| 67 |
}
|
| 68 |
|
| 69 |
# Default steps for each mode
|
| 70 |
DEFAULT_STEPS = {
|
| 71 |
"Distilled (4 steps)": 4,
|
| 72 |
+
"Base (50 steps)": 50,
|
| 73 |
}
|
| 74 |
|
| 75 |
DEFAULT_CFG = {
|
| 76 |
"Distilled (4 steps)": 1.0,
|
| 77 |
+
"Base (50 steps)": 4.0,
|
| 78 |
}
|
| 79 |
|
| 80 |
def image_to_data_uri(img):
|
|
|
|
| 257 |
|
| 258 |
mode_choice = gr.Radio(
|
| 259 |
label="Mode",
|
| 260 |
+
choices=["Distilled (4 steps)", "Base (50 steps)"],
|
| 261 |
value="Distilled (4 steps)",
|
| 262 |
)
|
| 263 |
|
requirements.txt
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
transformers
|
| 2 |
accelerate
|
| 3 |
safetensors
|
|
|
|
| 1 |
+
git+https://github.com/diffusers.git
|
| 2 |
transformers
|
| 3 |
accelerate
|
| 4 |
safetensors
|