Update app.py
Browse files
app.py
CHANGED
@@ -4,11 +4,11 @@ from diffusers import DiffusionPipeline
|
|
4 |
|
5 |
|
6 |
# Function to generate image based on input text
|
7 |
-
def generate_image(prompt):
|
8 |
# Load the pipeline
|
9 |
|
10 |
-
pipeline = DiffusionPipeline.from_pretrained(
|
11 |
-
pipeline.load_lora_weights(
|
12 |
|
13 |
# Generate the image using the text prompt
|
14 |
image = pipeline(prompt).images[0]
|
@@ -18,19 +18,25 @@ def generate_image(prompt):
|
|
18 |
with gr.Blocks() as demo:
|
19 |
# Title
|
20 |
gr.Markdown("# Text-to-Image Generation WebUI")
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
# Input for text prompt
|
23 |
with gr.Row():
|
24 |
prompt = gr.Textbox(label="Enter your prompt here", placeholder="Type your text prompt...")
|
25 |
|
26 |
# Output image display
|
27 |
-
|
|
|
28 |
|
29 |
# Button to trigger the image generation
|
30 |
generate_button = gr.Button("Generate Image")
|
31 |
|
32 |
# When the button is clicked, call the generate_image function
|
33 |
-
generate_button.click(fn=generate_image, inputs=prompt, outputs=output_image)
|
34 |
|
35 |
# Launch the interface
|
36 |
demo.launch()
|
|
|
4 |
|
5 |
|
6 |
# Function to generate image based on input text
|
7 |
+
def generate_image(basem, model, prompt):
|
8 |
# Load the pipeline
|
9 |
|
10 |
+
pipeline = DiffusionPipeline.from_pretrained(basem)
|
11 |
+
pipeline.load_lora_weights(model)
|
12 |
|
13 |
# Generate the image using the text prompt
|
14 |
image = pipeline(prompt).images[0]
|
|
|
18 |
with gr.Blocks() as demo:
|
19 |
# Title
|
20 |
gr.Markdown("# Text-to-Image Generation WebUI")
|
21 |
+
|
22 |
+
with gr.Row():
|
23 |
+
base_model = gr.Textbox(label="Enter your base model here", placeholder="John6666/mala-anime-mix-nsfw-pony-xl-v3-sdxl")
|
24 |
+
main_model = gr.Textbox(label="Enter your main model here", placeholder="nevreal/vMurderDrones")
|
25 |
+
|
26 |
|
27 |
# Input for text prompt
|
28 |
with gr.Row():
|
29 |
prompt = gr.Textbox(label="Enter your prompt here", placeholder="Type your text prompt...")
|
30 |
|
31 |
# Output image display
|
32 |
+
with gr.Row(scale=4):
|
33 |
+
output_image = gr.Image(label="Generated Image")
|
34 |
|
35 |
# Button to trigger the image generation
|
36 |
generate_button = gr.Button("Generate Image")
|
37 |
|
38 |
# When the button is clicked, call the generate_image function
|
39 |
+
generate_button.click(fn=generate_image, inputs=base_model, main_model, prompt, outputs=output_image)
|
40 |
|
41 |
# Launch the interface
|
42 |
demo.launch()
|