Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ from typing import Tuple
|
|
10 |
import numpy as np
|
11 |
from huggingface_hub import login
|
12 |
|
13 |
-
#
|
14 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
15 |
if HF_TOKEN:
|
16 |
login(HF_TOKEN)
|
@@ -28,12 +28,11 @@ def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
|
|
28 |
|
29 |
MAX_SEED = np.iinfo(np.int32).max
|
30 |
|
31 |
-
# Description for the UI
|
32 |
DESCRIPTIONz = ""
|
33 |
if not torch.cuda.is_available():
|
34 |
DESCRIPTIONz += "\n<p>⚠️ Running on CPU. This may not work as expected.</p>"
|
35 |
|
36 |
-
# Load base model and LoRA weights
|
37 |
base_model = "black-forest-labs/FLUX.1-dev"
|
38 |
pipe = DiffusionPipeline.from_pretrained(base_model, torch_dtype=torch.bfloat16, use_auth_token=HF_TOKEN)
|
39 |
lora_repo = "strangerzonehf/Flux-Super-Realism-LoRA"
|
@@ -55,10 +54,7 @@ style_list = [
|
|
55 |
"name": "HD+",
|
56 |
"prompt": "hyper-realistic 2K image of {prompt}. ultra-detailed, lifelike, high-resolution, sharp, vibrant colors, photorealistic",
|
57 |
},
|
58 |
-
|
59 |
-
"name": "Style Zero",
|
60 |
-
"prompt": "{prompt}",
|
61 |
-
},
|
62 |
]
|
63 |
styles = {k["name"]: k["prompt"] for k in style_list}
|
64 |
DEFAULT_STYLE_NAME = "3840 x 2160"
|
@@ -104,18 +100,23 @@ examples = [
|
|
104 |
"Super-realism, Purple Dreamy, a medium-angle shot of a young woman with long brown hair, wearing a pair of eye-level glasses, stands in front of a backdrop of purple and white lights. The woman's eyes are closed, her lips slightly parted, as if she is looking up at the sky. Her hair cascades over her shoulders, framing her face. She wears a sleeveless top adorned with tiny white dots and a gold chain necklace around her neck. Her left earrings add a pop of color to the scene."
|
105 |
]
|
106 |
|
107 |
-
# Updated CSS
|
108 |
css = '''
|
109 |
.gradio-container {
|
110 |
-
max-width:
|
111 |
-
background-color: #
|
112 |
padding: 20px;
|
113 |
-
border-radius:
|
114 |
-
box-shadow:
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
116 |
h1 {
|
117 |
text-align: center;
|
118 |
-
color: #
|
119 |
margin-bottom: 10px;
|
120 |
}
|
121 |
footer {
|
@@ -132,8 +133,12 @@ footer {
|
|
132 |
background-color: #6a0dad !important;
|
133 |
}
|
134 |
.accordion-header {
|
135 |
-
background-color: #
|
136 |
-
color:
|
|
|
|
|
|
|
|
|
137 |
}
|
138 |
'''
|
139 |
|
|
|
10 |
import numpy as np
|
11 |
from huggingface_hub import login
|
12 |
|
13 |
+
# One-time Hugging Face authentication
|
14 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
15 |
if HF_TOKEN:
|
16 |
login(HF_TOKEN)
|
|
|
28 |
|
29 |
MAX_SEED = np.iinfo(np.int32).max
|
30 |
|
|
|
31 |
DESCRIPTIONz = ""
|
32 |
if not torch.cuda.is_available():
|
33 |
DESCRIPTIONz += "\n<p>⚠️ Running on CPU. This may not work as expected.</p>"
|
34 |
|
35 |
+
# Load base model and LoRA weights
|
36 |
base_model = "black-forest-labs/FLUX.1-dev"
|
37 |
pipe = DiffusionPipeline.from_pretrained(base_model, torch_dtype=torch.bfloat16, use_auth_token=HF_TOKEN)
|
38 |
lora_repo = "strangerzonehf/Flux-Super-Realism-LoRA"
|
|
|
54 |
"name": "HD+",
|
55 |
"prompt": "hyper-realistic 2K image of {prompt}. ultra-detailed, lifelike, high-resolution, sharp, vibrant colors, photorealistic",
|
56 |
},
|
57 |
+
|
|
|
|
|
|
|
58 |
]
|
59 |
styles = {k["name"]: k["prompt"] for k in style_list}
|
60 |
DEFAULT_STYLE_NAME = "3840 x 2160"
|
|
|
100 |
"Super-realism, Purple Dreamy, a medium-angle shot of a young woman with long brown hair, wearing a pair of eye-level glasses, stands in front of a backdrop of purple and white lights. The woman's eyes are closed, her lips slightly parted, as if she is looking up at the sky. Her hair cascades over her shoulders, framing her face. She wears a sleeveless top adorned with tiny white dots and a gold chain necklace around her neck. Her left earrings add a pop of color to the scene."
|
101 |
]
|
102 |
|
103 |
+
# Updated CSS: full-width container, dark theme with black background, and violet accents
|
104 |
css = '''
|
105 |
.gradio-container {
|
106 |
+
max-width: 100% !important;
|
107 |
+
background-color: #000000;
|
108 |
padding: 20px;
|
109 |
+
border-radius: 0px;
|
110 |
+
box-shadow: none;
|
111 |
+
color: white;
|
112 |
+
}
|
113 |
+
body {
|
114 |
+
background-color: #000000;
|
115 |
+
color: white;
|
116 |
}
|
117 |
h1 {
|
118 |
text-align: center;
|
119 |
+
color: #8A2BE2;
|
120 |
margin-bottom: 10px;
|
121 |
}
|
122 |
footer {
|
|
|
133 |
background-color: #6a0dad !important;
|
134 |
}
|
135 |
.accordion-header {
|
136 |
+
background-color: #1a1a1a;
|
137 |
+
color: white;
|
138 |
+
}
|
139 |
+
.gradio-container .accordion-content {
|
140 |
+
background-color: #000000;
|
141 |
+
color: white;
|
142 |
}
|
143 |
'''
|
144 |
|