Commit
·
a3dc06c
1
Parent(s):
0b091b4
webui.py
CHANGED
|
@@ -1,50 +1,31 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import random
|
| 3 |
-
import time
|
| 4 |
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
def add_text(history, text):
|
| 7 |
-
history = history + [(text, None)]
|
| 8 |
-
return history, gr.update(value="", interactive=False)
|
| 9 |
|
|
|
|
| 10 |
|
| 11 |
-
|
| 12 |
-
history = history + [(('./outputs/a.png',), ('./outputs/a.png', './outputs/a.png'))]
|
| 13 |
-
return history
|
| 14 |
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
# history[-1][1] = ""
|
| 19 |
-
for character in response:
|
| 20 |
-
# history[-1][1] += character
|
| 21 |
-
# time.sleep(0.05)
|
| 22 |
-
yield history
|
| 23 |
|
| 24 |
|
| 25 |
-
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
-
|
| 29 |
-
with gr.Column(scale=0.85):
|
| 30 |
-
txt = gr.Textbox(
|
| 31 |
-
show_label=False,
|
| 32 |
-
placeholder="Type prompt here.",
|
| 33 |
-
container=False
|
| 34 |
-
)
|
| 35 |
-
with gr.Column(scale=0.15, min_width=0):
|
| 36 |
-
btn = gr.UploadButton("Generate", file_types=["image"])
|
| 37 |
-
|
| 38 |
-
with gr.Row():
|
| 39 |
-
gr.Checkbox(label='Advanced Setting', value=False, container=False)
|
| 40 |
-
|
| 41 |
-
txt_msg = txt.submit(add_text, [chatbot, txt], [chatbot, txt], queue=False).then(
|
| 42 |
-
bot, chatbot, chatbot
|
| 43 |
-
)
|
| 44 |
-
txt_msg.then(lambda: gr.update(interactive=True), None, [txt], queue=False)
|
| 45 |
-
file_msg = btn.upload(add_file, [chatbot, btn], [chatbot], queue=False).then(
|
| 46 |
-
bot, chatbot, chatbot
|
| 47 |
-
)
|
| 48 |
-
|
| 49 |
-
demo.queue() # number size style quality seed
|
| 50 |
-
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
| 2 |
|
| 3 |
+
from modules.sdxl_styles import apply_style
|
| 4 |
+
from modules.default_pipeline import process
|
| 5 |
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
def generate_clicked(positive_prompt):
|
| 8 |
|
| 9 |
+
p, n = apply_style('cinematic-default', positive_prompt, '')
|
|
|
|
|
|
|
| 10 |
|
| 11 |
+
print(p)
|
| 12 |
+
print(n)
|
| 13 |
|
| 14 |
+
return process(positive_prompt=p,
|
| 15 |
+
negative_prompt=n)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
|
| 18 |
+
block = gr.Blocks().queue()
|
| 19 |
+
with block:
|
| 20 |
+
with gr.Column():
|
| 21 |
+
gallery = gr.Gallery(label='Gallery', show_label=False, object_fit='contain', height=768)
|
| 22 |
+
with gr.Row():
|
| 23 |
+
with gr.Column(scale=0.85):
|
| 24 |
+
prompt = gr.Textbox(show_label=False, placeholder="Type prompt here.", container=False)
|
| 25 |
+
with gr.Column(scale=0.15, min_width=0):
|
| 26 |
+
run_button = gr.Button(label="Generate", value="Generate")
|
| 27 |
+
with gr.Row():
|
| 28 |
+
advanced_checkbox = gr.Checkbox(label='Advanced', value=False, container=False)
|
| 29 |
+
run_button.click(fn=generate_clicked, inputs=[prompt], outputs=[gallery])
|
| 30 |
|
| 31 |
+
block.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|