Spaces:
Running
on
Zero
Running
on
Zero
update app
Browse files
app.py
CHANGED
|
@@ -29,27 +29,27 @@ print("Using device:", device)
|
|
| 29 |
from gradio.themes import Soft
|
| 30 |
from gradio.themes.utils import colors, fonts, sizes
|
| 31 |
|
| 32 |
-
colors.
|
| 33 |
-
name="
|
| 34 |
-
c50="#
|
| 35 |
-
c100="#
|
| 36 |
-
c200="#
|
| 37 |
-
c300="#
|
| 38 |
-
c400="#
|
| 39 |
-
c500="#
|
| 40 |
-
c600="#
|
| 41 |
-
c700="#
|
| 42 |
-
c800="#
|
| 43 |
-
c900="#
|
| 44 |
-
c950="#
|
| 45 |
)
|
| 46 |
|
| 47 |
-
class
|
| 48 |
def __init__(
|
| 49 |
self,
|
| 50 |
*,
|
| 51 |
primary_hue: colors.Color | str = colors.gray,
|
| 52 |
-
secondary_hue: colors.Color | str = colors.
|
| 53 |
neutral_hue: colors.Color | str = colors.slate,
|
| 54 |
text_size: sizes.Size | str = sizes.text_lg,
|
| 55 |
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
|
@@ -76,8 +76,8 @@ class SteelBlueTheme(Soft):
|
|
| 76 |
button_primary_text_color_hover="white",
|
| 77 |
button_primary_background_fill="linear-gradient(90deg, *secondary_500, *secondary_600)",
|
| 78 |
button_primary_background_fill_hover="linear-gradient(90deg, *secondary_600, *secondary_700)",
|
| 79 |
-
button_primary_background_fill_dark="linear-gradient(90deg, *secondary_600, *
|
| 80 |
-
button_primary_background_fill_hover_dark="linear-gradient(90deg, *secondary_500, *
|
| 81 |
button_secondary_text_color="black",
|
| 82 |
button_secondary_text_color_hover="white",
|
| 83 |
button_secondary_background_fill="linear-gradient(90deg, *primary_300, *primary_300)",
|
|
@@ -95,7 +95,7 @@ class SteelBlueTheme(Soft):
|
|
| 95 |
block_label_background_fill="*primary_200",
|
| 96 |
)
|
| 97 |
|
| 98 |
-
|
| 99 |
|
| 100 |
# --- Main Model Initialization ---
|
| 101 |
MAX_SEED = np.iinfo(np.int32).max
|
|
@@ -170,7 +170,7 @@ css="""
|
|
| 170 |
margin: 0 auto;
|
| 171 |
max-width: 960px;
|
| 172 |
}
|
| 173 |
-
#main-title h1 {font-size: 2.
|
| 174 |
"""
|
| 175 |
|
| 176 |
with gr.Blocks() as demo:
|
|
@@ -181,16 +181,16 @@ with gr.Blocks() as demo:
|
|
| 181 |
|
| 182 |
with gr.Row():
|
| 183 |
with gr.Column():
|
| 184 |
-
input_image = gr.Image(label="Upload Image", type="pil", height=
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
with gr.Accordion("Advanced Settings", open=False):
|
| 195 |
|
| 196 |
seed = gr.Slider(
|
|
@@ -220,7 +220,7 @@ with gr.Blocks() as demo:
|
|
| 220 |
)
|
| 221 |
|
| 222 |
with gr.Column():
|
| 223 |
-
output_image = gr.Image(label="Output Image", interactive=False)
|
| 224 |
reuse_button = gr.Button("Reuse this image", visible=False)
|
| 225 |
|
| 226 |
with gr.Row():
|
|
@@ -266,4 +266,4 @@ with gr.Blocks() as demo:
|
|
| 266 |
outputs=[input_image]
|
| 267 |
)
|
| 268 |
|
| 269 |
-
demo.launch(css=css, theme=
|
|
|
|
| 29 |
from gradio.themes import Soft
|
| 30 |
from gradio.themes.utils import colors, fonts, sizes
|
| 31 |
|
| 32 |
+
colors.orange_red = colors.Color(
|
| 33 |
+
name="orange_red",
|
| 34 |
+
c50="#FFF0E5",
|
| 35 |
+
c100="#FFE0CC",
|
| 36 |
+
c200="#FFC299",
|
| 37 |
+
c300="#FFA366",
|
| 38 |
+
c400="#FF8533",
|
| 39 |
+
c500="#FF4500",
|
| 40 |
+
c600="#E63E00",
|
| 41 |
+
c700="#CC3700",
|
| 42 |
+
c800="#B33000",
|
| 43 |
+
c900="#992900",
|
| 44 |
+
c950="#802200",
|
| 45 |
)
|
| 46 |
|
| 47 |
+
class OrangeRedTheme(Soft):
|
| 48 |
def __init__(
|
| 49 |
self,
|
| 50 |
*,
|
| 51 |
primary_hue: colors.Color | str = colors.gray,
|
| 52 |
+
secondary_hue: colors.Color | str = colors.orange_red,
|
| 53 |
neutral_hue: colors.Color | str = colors.slate,
|
| 54 |
text_size: sizes.Size | str = sizes.text_lg,
|
| 55 |
font: fonts.Font | str | Iterable[fonts.Font | str] = (
|
|
|
|
| 76 |
button_primary_text_color_hover="white",
|
| 77 |
button_primary_background_fill="linear-gradient(90deg, *secondary_500, *secondary_600)",
|
| 78 |
button_primary_background_fill_hover="linear-gradient(90deg, *secondary_600, *secondary_700)",
|
| 79 |
+
button_primary_background_fill_dark="linear-gradient(90deg, *secondary_600, *secondary_700)",
|
| 80 |
+
button_primary_background_fill_hover_dark="linear-gradient(90deg, *secondary_500, *secondary_600)",
|
| 81 |
button_secondary_text_color="black",
|
| 82 |
button_secondary_text_color_hover="white",
|
| 83 |
button_secondary_background_fill="linear-gradient(90deg, *primary_300, *primary_300)",
|
|
|
|
| 95 |
block_label_background_fill="*primary_200",
|
| 96 |
)
|
| 97 |
|
| 98 |
+
orange_red_theme = OrangeRedTheme()
|
| 99 |
|
| 100 |
# --- Main Model Initialization ---
|
| 101 |
MAX_SEED = np.iinfo(np.int32).max
|
|
|
|
| 170 |
margin: 0 auto;
|
| 171 |
max-width: 960px;
|
| 172 |
}
|
| 173 |
+
#main-title h1 {font-size: 2.2em !important;}
|
| 174 |
"""
|
| 175 |
|
| 176 |
with gr.Blocks() as demo:
|
|
|
|
| 181 |
|
| 182 |
with gr.Row():
|
| 183 |
with gr.Column():
|
| 184 |
+
input_image = gr.Image(label="Upload Image", type="pil", height=290)
|
| 185 |
+
|
| 186 |
+
prompt = gr.Text(
|
| 187 |
+
label="Edit Prompt",
|
| 188 |
+
show_label=True,
|
| 189 |
+
placeholder="e.g., transform into anime..",
|
| 190 |
+
)
|
| 191 |
+
|
| 192 |
+
run_button = gr.Button("Edit Image", variant="primary")
|
| 193 |
+
|
| 194 |
with gr.Accordion("Advanced Settings", open=False):
|
| 195 |
|
| 196 |
seed = gr.Slider(
|
|
|
|
| 220 |
)
|
| 221 |
|
| 222 |
with gr.Column():
|
| 223 |
+
output_image = gr.Image(label="Output Image", interactive=False, format="png", height=323)
|
| 224 |
reuse_button = gr.Button("Reuse this image", visible=False)
|
| 225 |
|
| 226 |
with gr.Row():
|
|
|
|
| 266 |
outputs=[input_image]
|
| 267 |
)
|
| 268 |
|
| 269 |
+
demo.launch(css=css, theme=orange_red_theme, mcp_server=True, ssr_mode=False, show_error=True)
|