Spaces:
Sleeping
Sleeping
artificialguybr
commited on
Commit
•
c03b3ba
1
Parent(s):
3b1abe2
Update app.py
Browse files
app.py
CHANGED
@@ -32,28 +32,38 @@ def run_lora(prompt, weight):
|
|
32 |
# Gradio UI
|
33 |
print("Before Gradio Interface")
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
prompt = gr.Textbox(label="Prompt", lines=1, max_lines=1, placeholder="Type a prompt after selecting a LoRA")
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
print("After Gradio Interface")
|
|
|
|
|
|
|
|
32 |
# Gradio UI
|
33 |
print("Before Gradio Interface")
|
34 |
|
35 |
+
# Create a Gradio Blocks interface
|
36 |
+
with gr.Blocks() as app:
|
37 |
+
title = gr.HTML("<h1>LoRA the Explorer</h1>")
|
38 |
+
gallery = gr.Gallery(
|
39 |
+
[(item["image"], item["title"]) for item in loras],
|
40 |
+
label="LoRA Gallery",
|
41 |
+
allow_preview=False,
|
42 |
+
columns=3,
|
43 |
+
)
|
44 |
+
prompt = gr.Textbox(label="Prompt", lines=1, max_lines=1, placeholder="Type a prompt after selecting a LoRA")
|
45 |
+
advanced_options = gr.Accordion("Advanced options", open=False)
|
46 |
+
weight = gr.Slider(0, 10, value=1, step=0.1, label="LoRA weight")
|
47 |
+
result = gr.Image(interactive=False, label="Generated Image")
|
48 |
+
|
49 |
+
# Link the function to run when the button is clicked
|
50 |
+
gr.Row([
|
51 |
+
gr.Column([
|
52 |
+
title,
|
53 |
+
gallery,
|
54 |
+
prompt,
|
55 |
+
advanced_options,
|
56 |
+
weight,
|
57 |
+
gr.Button("Run", label="Run").click(
|
58 |
+
fn=run_lora,
|
59 |
+
inputs=[prompt, weight],
|
60 |
+
outputs=[result]
|
61 |
+
)
|
62 |
+
]),
|
63 |
+
gr.Column([result])
|
64 |
+
])
|
65 |
|
66 |
print("After Gradio Interface")
|
67 |
+
|
68 |
+
# Launch the Gradio interface with a queue
|
69 |
+
app.launch(debug=True, queue=True)
|