Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,24 +31,23 @@ def update_imgbox(choices):
|
|
| 31 |
return [gr.Image(None, label = m, visible = (m != 'NA')) for m in choices_plus]
|
| 32 |
|
| 33 |
|
| 34 |
-
def gen_fn(model_str, prompt
|
| 35 |
if model_str == 'NA':
|
| 36 |
return None
|
| 37 |
noise = str(randint(0, 99999999999))
|
| 38 |
-
return models_load[model_str](f'{prompt}'
|
| 39 |
|
| 40 |
|
| 41 |
with gr.Blocks() as demo:
|
| 42 |
with gr.Tab('Multiple models'):
|
| 43 |
with gr.Accordion('Model selection'):
|
| 44 |
-
|
| 45 |
|
| 46 |
-
txt_input = gr.Textbox(label='Positive Prompt text')
|
| 47 |
-
neg_txt_input = gr.Textbox(label='Negative Prompt (optional)', placeholder="e.g., no cars")
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
| 52 |
|
| 53 |
with gr.Row():
|
| 54 |
output = [gr.Image(label = m) for m in default_models]
|
|
|
|
| 31 |
return [gr.Image(None, label = m, visible = (m != 'NA')) for m in choices_plus]
|
| 32 |
|
| 33 |
|
| 34 |
+
def gen_fn(model_str, prompt):
|
| 35 |
if model_str == 'NA':
|
| 36 |
return None
|
| 37 |
noise = str(randint(0, 99999999999))
|
| 38 |
+
return models_load[model_str](f'{prompt} {noise}')
|
| 39 |
|
| 40 |
|
| 41 |
with gr.Blocks() as demo:
|
| 42 |
with gr.Tab('Multiple models'):
|
| 43 |
with gr.Accordion('Model selection'):
|
| 44 |
+
model_choice = gr.CheckboxGroup(models, label = f'Choose up to {num_models} different models', value = default_models, multiselect = True, max_choices = num_models, interactive = True, filterable = False)
|
| 45 |
|
|
|
|
|
|
|
| 46 |
|
| 47 |
+
txt_input = gr.Textbox(label = 'Prompt text')
|
| 48 |
+
gen_button = gr.Button('Generate')
|
| 49 |
+
stop_button = gr.Button('Stop', variant = 'secondary', interactive = False)
|
| 50 |
+
gen_button.click(lambda s: gr.update(interactive = True), None, stop_button)
|
| 51 |
|
| 52 |
with gr.Row():
|
| 53 |
output = [gr.Image(label = m) for m in default_models]
|