Spaces:
Paused
Paused
johann-foerster
commited on
Commit
·
c5aa8f3
1
Parent(s):
81c7641
remove example translation
Browse files
webui.py
CHANGED
@@ -9,9 +9,9 @@ from modules.sdxl_styles import style_keys, aspect_ratios
|
|
9 |
|
10 |
QM_LOGO = Image.open("resources/qm_logo.png")
|
11 |
QM_COLOR = Color(name="qm", c50="#effaed",c100="#def5db",c200="#64b445",c300="#c6eec0",c400="#b9ebb3",c500="#64b445",c600="#55993b",c700="#467e30",c800="#325a23",c900="#233f18",c950="#192d11")
|
12 |
-
PROMPT_EXAMPLES = [
|
13 |
-
|
14 |
-
|
15 |
EXAMPLE_GREETINGS = [
|
16 |
"Ich wünsche dir von Herzen ein frohes Fest.",
|
17 |
"Frohes Fest und viele glückliche Momente mit deinen Liebsten!",
|
@@ -48,9 +48,6 @@ def generate(*args):
|
|
48 |
finished = True
|
49 |
return
|
50 |
|
51 |
-
def translate_promt_example(prompt_de):
|
52 |
-
return [x for x in PROMPT_EXAMPLES if x[0] == prompt_de][0][1]
|
53 |
-
|
54 |
def toggle_greet_visibility(is_visible):
|
55 |
return gr.Row(visible=is_visible)
|
56 |
|
@@ -134,8 +131,7 @@ with shared.gradio_root:
|
|
134 |
progress_html = gr.HTML(visible=True, elem_id='progress-bar', elem_classes='progress-bar')
|
135 |
run_button = gr.Button(value="Weihnachtskarte\nerstellen", variant='primary', elem_id='generate-button', )
|
136 |
with gr.Row():
|
137 |
-
|
138 |
-
gr.Examples(elem_id="prompt-examples", examples=PROMPT_EXAMPLES, inputs=[promt_example_de], cache_examples=False)
|
139 |
|
140 |
toggle_greet = gr.Checkbox(label="Persönliche Weihnachtsgrüße hinzufügen", elem_id="toggle-greet-checkbox",
|
141 |
container=False, value=True, interactive=True)
|
@@ -151,8 +147,6 @@ with shared.gradio_root:
|
|
151 |
generated_image_overlayed = gr.Image(label="Weihnachtskarte", type='pil', elem_classes="generated-image", width=1280,
|
152 |
value=overlay_image(INIT_IMAGE_PATH, toggle_greet.value, greet.value), show_share_button=False)
|
153 |
generated_image_path = gr.Text(visible=False, value=INIT_IMAGE_PATH, container=False, show_label=False)
|
154 |
-
|
155 |
-
promt_example_de.change(fn=translate_promt_example, inputs=[promt_example_de], outputs=[prompt], queue=False)
|
156 |
toggle_greet.change(fn=toggle_greet_visibility, inputs=[toggle_greet], outputs=[greeting_row], queue=False, show_progress=False)\
|
157 |
.then(fn=make_overlay, inputs=[generated_image_path, toggle_greet, greet], outputs=[generated_image_overlayed, greet_active], show_progress=False, queue=False)
|
158 |
greet.input(fn=None, inputs=[greet], outputs=[greet], _js="(greet) => { return greet.split('\\n').slice(0,2).join('\\n') }")
|
|
|
9 |
|
10 |
QM_LOGO = Image.open("resources/qm_logo.png")
|
11 |
QM_COLOR = Color(name="qm", c50="#effaed",c100="#def5db",c200="#64b445",c300="#c6eec0",c400="#b9ebb3",c500="#64b445",c600="#55993b",c700="#467e30",c800="#325a23",c900="#233f18",c950="#192d11")
|
12 |
+
PROMPT_EXAMPLES = ["Santa Claus with his sack full of gifts",
|
13 |
+
"Scenic winter village inside a snow globe",
|
14 |
+
"Cute penguins wrapped up in scarves and hats"]
|
15 |
EXAMPLE_GREETINGS = [
|
16 |
"Ich wünsche dir von Herzen ein frohes Fest.",
|
17 |
"Frohes Fest und viele glückliche Momente mit deinen Liebsten!",
|
|
|
48 |
finished = True
|
49 |
return
|
50 |
|
|
|
|
|
|
|
51 |
def toggle_greet_visibility(is_visible):
|
52 |
return gr.Row(visible=is_visible)
|
53 |
|
|
|
131 |
progress_html = gr.HTML(visible=True, elem_id='progress-bar', elem_classes='progress-bar')
|
132 |
run_button = gr.Button(value="Weihnachtskarte\nerstellen", variant='primary', elem_id='generate-button', )
|
133 |
with gr.Row():
|
134 |
+
gr.Examples(elem_id="prompt-examples", examples=PROMPT_EXAMPLES, inputs=[prompt])
|
|
|
135 |
|
136 |
toggle_greet = gr.Checkbox(label="Persönliche Weihnachtsgrüße hinzufügen", elem_id="toggle-greet-checkbox",
|
137 |
container=False, value=True, interactive=True)
|
|
|
147 |
generated_image_overlayed = gr.Image(label="Weihnachtskarte", type='pil', elem_classes="generated-image", width=1280,
|
148 |
value=overlay_image(INIT_IMAGE_PATH, toggle_greet.value, greet.value), show_share_button=False)
|
149 |
generated_image_path = gr.Text(visible=False, value=INIT_IMAGE_PATH, container=False, show_label=False)
|
|
|
|
|
150 |
toggle_greet.change(fn=toggle_greet_visibility, inputs=[toggle_greet], outputs=[greeting_row], queue=False, show_progress=False)\
|
151 |
.then(fn=make_overlay, inputs=[generated_image_path, toggle_greet, greet], outputs=[generated_image_overlayed, greet_active], show_progress=False, queue=False)
|
152 |
greet.input(fn=None, inputs=[greet], outputs=[greet], _js="(greet) => { return greet.split('\\n').slice(0,2).join('\\n') }")
|