Update app.py
Browse files
app.py
CHANGED
|
@@ -57,16 +57,16 @@ def update_imgbox(choices):
|
|
| 57 |
executor = ThreadPoolExecutor(max_workers=num_models)
|
| 58 |
|
| 59 |
|
| 60 |
-
def gen_fn(model_str, prompt
|
| 61 |
if model_str == 'NA':
|
| 62 |
return None
|
| 63 |
|
| 64 |
noise = str(randint(0, 9999))
|
| 65 |
-
combined_prompt = f'{prompt}
|
| 66 |
print(f"Generating with prompt: {combined_prompt}")
|
| 67 |
|
| 68 |
try:
|
| 69 |
-
image_response = models_load[model_str](f'{prompt} {
|
| 70 |
# print(f"77 {models_load[model_str](f'{combined_prompt}')}")
|
| 71 |
# image_response = models_load[model_str](f'{combined_prompt}')
|
| 72 |
# Ensure the response is an image or image-like object
|
|
@@ -86,7 +86,6 @@ def gen_fn(model_str, prompt, negative_prompt):
|
|
| 86 |
def make_me():
|
| 87 |
with gr.Row():
|
| 88 |
txt_input = gr.Textbox(lines=2, value=kii)
|
| 89 |
-
negative_prompt_input = gr.Textbox(lines=2, value="", label="Negative Prompt")
|
| 90 |
gen_button = gr.Button('Generate images')
|
| 91 |
# stop_button = gr.Button('Stop', variant='secondary', interactive=False)
|
| 92 |
|
|
@@ -105,7 +104,7 @@ def make_me():
|
|
| 105 |
output = [gr.Image(label=m) for m in default_models]
|
| 106 |
current_models = [gr.Textbox(m, visible=False) for m in default_models]
|
| 107 |
for m, o in zip(current_models, output):
|
| 108 |
-
gen_event = gen_button.click(gen_fn, [m, txt_input
|
| 109 |
|
| 110 |
with gr.Accordion('Model selection', visible=False):
|
| 111 |
model_choice = gr.CheckboxGroup(models, label=f' {num_models} different models selected', value=default_models, interactive=True)
|
|
|
|
| 57 |
executor = ThreadPoolExecutor(max_workers=num_models)
|
| 58 |
|
| 59 |
|
| 60 |
+
def gen_fn(model_str, prompt):
|
| 61 |
if model_str == 'NA':
|
| 62 |
return None
|
| 63 |
|
| 64 |
noise = str(randint(0, 9999))
|
| 65 |
+
combined_prompt = f'{prompt}'
|
| 66 |
print(f"Generating with prompt: {combined_prompt}")
|
| 67 |
|
| 68 |
try:
|
| 69 |
+
image_response = models_load[model_str](f'{prompt} {noise}')
|
| 70 |
# print(f"77 {models_load[model_str](f'{combined_prompt}')}")
|
| 71 |
# image_response = models_load[model_str](f'{combined_prompt}')
|
| 72 |
# Ensure the response is an image or image-like object
|
|
|
|
| 86 |
def make_me():
|
| 87 |
with gr.Row():
|
| 88 |
txt_input = gr.Textbox(lines=2, value=kii)
|
|
|
|
| 89 |
gen_button = gr.Button('Generate images')
|
| 90 |
# stop_button = gr.Button('Stop', variant='secondary', interactive=False)
|
| 91 |
|
|
|
|
| 104 |
output = [gr.Image(label=m) for m in default_models]
|
| 105 |
current_models = [gr.Textbox(m, visible=False) for m in default_models]
|
| 106 |
for m, o in zip(current_models, output):
|
| 107 |
+
gen_event = gen_button.click(gen_fn, [m, txt_input], o, queue=False)
|
| 108 |
|
| 109 |
with gr.Accordion('Model selection', visible=False):
|
| 110 |
model_choice = gr.CheckboxGroup(models, label=f' {num_models} different models selected', value=default_models, interactive=True)
|