Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,13 @@ import gradio as gr
|
|
2 |
import os
|
3 |
import modules.wdtagger
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
# Daftar model dan ControlNet
|
6 |
models = ["Model A", "Model B", "Model C"]
|
7 |
vae = ["VAE A", "VAE B", "VAE C"]
|
@@ -43,7 +50,7 @@ def intpaint_func (image, controlnet_type, model):
|
|
43 |
with gr.Blocks(css= "style.css") as app:
|
44 |
# Dropdown untuk memilih model di luar tab dengan lebar kecil
|
45 |
with gr.Row():
|
46 |
-
|
47 |
vae_dropdown = gr.Dropdown(choices=vae, label="VAE", value="VAE C")
|
48 |
|
49 |
# Tab untuk Text-to-Image
|
@@ -92,7 +99,7 @@ with gr.Blocks(css= "style.css") as app:
|
|
92 |
# Update fungsi sesuai kebutuhan
|
93 |
return generate_image(prompt, neg_prompt, width, height, scheduler, num_steps, num_images, cfg_scale, seed, model)
|
94 |
|
95 |
-
generate_button.click(fn=update_images, inputs=[prompt_input, neg_prompt_input, width_input, height_input, scheduler_input, num_steps_input, batch_size, batch_count, cfg_scale_input, seed_input,
|
96 |
|
97 |
# Tab untuk Image-to-Image
|
98 |
with gr.Tab("Image-to-Image"):
|
@@ -124,7 +131,7 @@ with gr.Blocks(css= "style.css") as app:
|
|
124 |
# Update fungsi sesuai kebutuhan
|
125 |
return process_image(image, prompt, neg_prompt, model)
|
126 |
|
127 |
-
generate_button_i2i.click(fn=process_image_func, inputs=[image_input, prompt_input_i2i, neg_prompt_input_i2i,
|
128 |
|
129 |
# Tab untuk ControlNet
|
130 |
with gr.Tab("ControlNet"):
|
@@ -136,7 +143,7 @@ with gr.Blocks(css= "style.css") as app:
|
|
136 |
|
137 |
with gr.Column():
|
138 |
controlnet_output_image = gr.Image(label="Hasil ControlNet")
|
139 |
-
controlnet_button.click(fn=controlnet_process_func, inputs=[controlnet_image_input, controlnet_dropdown,
|
140 |
|
141 |
# Tab untuk Intpainting
|
142 |
with gr.Tab ("Inpainting"):
|
|
|
2 |
import os
|
3 |
import modules.wdtagger
|
4 |
|
5 |
+
from modules.model import get_model_and_vae_options
|
6 |
+
from modules.text2img import generate_image_wrapper
|
7 |
+
|
8 |
+
# Mendapatkan daftar model dan VAE untuk dropdown
|
9 |
+
all_models, all_vaes = get_model_and_vae_options()
|
10 |
+
|
11 |
+
|
12 |
# Daftar model dan ControlNet
|
13 |
models = ["Model A", "Model B", "Model C"]
|
14 |
vae = ["VAE A", "VAE B", "VAE C"]
|
|
|
50 |
with gr.Blocks(css= "style.css") as app:
|
51 |
# Dropdown untuk memilih model di luar tab dengan lebar kecil
|
52 |
with gr.Row():
|
53 |
+
checkpoint_dropdown = gr.Dropdown(choices=models, label="Model", value="Model B")
|
54 |
vae_dropdown = gr.Dropdown(choices=vae, label="VAE", value="VAE C")
|
55 |
|
56 |
# Tab untuk Text-to-Image
|
|
|
99 |
# Update fungsi sesuai kebutuhan
|
100 |
return generate_image(prompt, neg_prompt, width, height, scheduler, num_steps, num_images, cfg_scale, seed, model)
|
101 |
|
102 |
+
generate_button.click(fn=update_images, inputs=[prompt_input, neg_prompt_input, width_input, height_input, scheduler_input, num_steps_input, batch_size, batch_count, cfg_scale_input, seed_input, checkpoint_dropdown, vae_dropdown], outputs=[output_gallery, output_text])
|
103 |
|
104 |
# Tab untuk Image-to-Image
|
105 |
with gr.Tab("Image-to-Image"):
|
|
|
131 |
# Update fungsi sesuai kebutuhan
|
132 |
return process_image(image, prompt, neg_prompt, model)
|
133 |
|
134 |
+
generate_button_i2i.click(fn=process_image_func, inputs=[image_input, prompt_input_i2i, neg_prompt_input_i2i, checkpoint_dropdown, vae_dropdown], outputs=output_image_i2i)
|
135 |
|
136 |
# Tab untuk ControlNet
|
137 |
with gr.Tab("ControlNet"):
|
|
|
143 |
|
144 |
with gr.Column():
|
145 |
controlnet_output_image = gr.Image(label="Hasil ControlNet")
|
146 |
+
controlnet_button.click(fn=controlnet_process_func, inputs=[controlnet_image_input, controlnet_dropdown, checkpoint_dropdown, vae_dropdown], outputs=controlnet_output_image)
|
147 |
|
148 |
# Tab untuk Intpainting
|
149 |
with gr.Tab ("Inpainting"):
|