Spaces:
Running
on
Zero
Running
on
Zero
update app
Browse files
app.py
CHANGED
|
@@ -27,6 +27,77 @@ if torch.cuda.is_available():
|
|
| 27 |
|
| 28 |
print("Using device:", device)
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
# --- Main Model Initialization ---
|
| 31 |
MAX_SEED = np.iinfo(np.int32).max
|
| 32 |
pipe = FluxKontextPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev", torch_dtype=torch.bfloat16).to("cuda")
|
|
@@ -103,7 +174,7 @@ css="""
|
|
| 103 |
#main-title h1 {font-size: 2.1em !important;}
|
| 104 |
"""
|
| 105 |
|
| 106 |
-
with gr.Blocks(css=css, theme=
|
| 107 |
|
| 108 |
with gr.Column(elem_id="col-container"):
|
| 109 |
gr.Markdown("# **Photo-Mate-i2i**", elem_id="main-title")
|
|
|
|
| 27 |
|
| 28 |
print("Using device:", device)
|
| 29 |
|
| 30 |
+
from gradio.themes import Soft
|
| 31 |
+
from gradio.themes.utils import colors, fonts, sizes
|
| 32 |
+
|
| 33 |
+
colors.steel_blue = colors.Color(
|
| 34 |
+
name="steel_blue",
|
| 35 |
+
c50="#EBF3F8",
|
| 36 |
+
c100="#D3E5F0",
|
| 37 |
+
c200="#A8CCE1",
|
| 38 |
+
c300="#7DB3D2",
|
| 39 |
+
c400="#529AC3",
|
| 40 |
+
c500="#4682B4",
|
| 41 |
+
c600="#3E72A0",
|
| 42 |
+
c700="#36638C",
|
| 43 |
+
c800="#2E5378",
|
| 44 |
+
c900="#264364",
|
| 45 |
+
c950="#1E3450",
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
class SteelBlueTheme(Soft):
|
| 49 |
+
def __init__(
|
| 50 |
+
self,
|
| 51 |
+
*,
|
| 52 |
+
primary_hue: colors.Color | str = colors.gray,
|
| 53 |
+
secondary_hue: colors.Color | str = colors.steel_blue,
|
| 54 |
+
neutral_hue: colors.Color | str = colors.slate,
|
| 55 |
+
text_size: sizes.Size | str = sizes.text_lg,
|
| 56 |
+
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
| 57 |
+
fonts.GoogleFont("Outfit"), "Arial", "sans-serif",
|
| 58 |
+
),
|
| 59 |
+
font_mono: fonts.Font | str | Iterable[fonts.Font | str] = (
|
| 60 |
+
fonts.GoogleFont("IBM Plex Mono"), "ui-monospace", "monospace",
|
| 61 |
+
),
|
| 62 |
+
):
|
| 63 |
+
super().__init__(
|
| 64 |
+
primary_hue=primary_hue,
|
| 65 |
+
secondary_hue=secondary_hue,
|
| 66 |
+
neutral_hue=neutral_hue,
|
| 67 |
+
text_size=text_size,
|
| 68 |
+
font=font,
|
| 69 |
+
font_mono=font_mono,
|
| 70 |
+
)
|
| 71 |
+
super().set(
|
| 72 |
+
background_fill_primary="*primary_50",
|
| 73 |
+
background_fill_primary_dark="*primary_900",
|
| 74 |
+
body_background_fill="linear-gradient(135deg, *primary_200, *primary_100)",
|
| 75 |
+
body_background_fill_dark="linear-gradient(135deg, *primary_900, *primary_800)",
|
| 76 |
+
button_primary_text_color="white",
|
| 77 |
+
button_primary_text_color_hover="white",
|
| 78 |
+
button_primary_background_fill="linear-gradient(90deg, *secondary_500, *secondary_600)",
|
| 79 |
+
button_primary_background_fill_hover="linear-gradient(90deg, *secondary_600, *secondary_700)",
|
| 80 |
+
button_primary_background_fill_dark="linear-gradient(90deg, *secondary_600, *secondary_800)",
|
| 81 |
+
button_primary_background_fill_hover_dark="linear-gradient(90deg, *secondary_500, *secondary_500)",
|
| 82 |
+
button_secondary_text_color="black",
|
| 83 |
+
button_secondary_text_color_hover="white",
|
| 84 |
+
button_secondary_background_fill="linear-gradient(90deg, *primary_300, *primary_300)",
|
| 85 |
+
button_secondary_background_fill_hover="linear-gradient(90deg, *primary_400, *primary_400)",
|
| 86 |
+
button_secondary_background_fill_dark="linear-gradient(90deg, *primary_500, *primary_600)",
|
| 87 |
+
button_secondary_background_fill_hover_dark="linear-gradient(90deg, *primary_500, *primary_500)",
|
| 88 |
+
slider_color="*secondary_500",
|
| 89 |
+
slider_color_dark="*secondary_600",
|
| 90 |
+
block_title_text_weight="600",
|
| 91 |
+
block_border_width="3px",
|
| 92 |
+
block_shadow="*shadow_drop_lg",
|
| 93 |
+
button_primary_shadow="*shadow_drop_lg",
|
| 94 |
+
button_large_padding="11px",
|
| 95 |
+
color_accent_soft="*primary_100",
|
| 96 |
+
block_label_background_fill="*primary_200",
|
| 97 |
+
)
|
| 98 |
+
|
| 99 |
+
steel_blue_theme = SteelBlueTheme()
|
| 100 |
+
|
| 101 |
# --- Main Model Initialization ---
|
| 102 |
MAX_SEED = np.iinfo(np.int32).max
|
| 103 |
pipe = FluxKontextPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev", torch_dtype=torch.bfloat16).to("cuda")
|
|
|
|
| 174 |
#main-title h1 {font-size: 2.1em !important;}
|
| 175 |
"""
|
| 176 |
|
| 177 |
+
with gr.Blocks(css=css, theme=steel_blue_theme) as demo:
|
| 178 |
|
| 179 |
with gr.Column(elem_id="col-container"):
|
| 180 |
gr.Markdown("# **Photo-Mate-i2i**", elem_id="main-title")
|