Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,7 @@ def get_current_time():
|
|
| 9 |
now = datetime.now()
|
| 10 |
now2 = now
|
| 11 |
current_time = now2.strftime("%Y-%m-%d %H:%M:%S")
|
| 12 |
-
ki = f'{
|
| 13 |
return ki
|
| 14 |
|
| 15 |
def load_fn(models):
|
|
@@ -25,10 +25,12 @@ def gen_fn(model_str, prompt):
|
|
| 25 |
noise = str(randint(0, 9999))
|
| 26 |
return models_load[model_str](f'{prompt} {noise}')
|
| 27 |
|
|
|
|
|
|
|
|
|
|
| 28 |
def make_me():
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
num_models = len(models) # Assuming models is a list of available models
|
| 32 |
|
| 33 |
with gr.Row():
|
| 34 |
txt_input = gr.Textbox(label='Your prompt:', lines=3)
|
|
@@ -46,7 +48,7 @@ def make_me():
|
|
| 46 |
stop_button.click(lambda s: gr.update(interactive=False), [stop_button], stop_button, cancels=[gen_event])
|
| 47 |
|
| 48 |
with gr.Accordion('Model selection'):
|
| 49 |
-
model_choice = gr.CheckboxGroup(models, label=f'{num_models} different models selected', value=default_models,
|
| 50 |
model_choice.change(update_imgbox, model_choice, output)
|
| 51 |
model_choice.change(extend_choices, model_choice, current_models)
|
| 52 |
|
|
@@ -61,5 +63,5 @@ with gr.Blocks(css="div.float.svelte-1mwvhlq { position: absolute; top: var(--bl
|
|
| 61 |
gr.Markdown("<script>" + js_code + "</script>")
|
| 62 |
make_me()
|
| 63 |
|
| 64 |
-
demo.queue(concurrency_count=
|
| 65 |
demo.launch()
|
|
|
|
| 9 |
now = datetime.now()
|
| 10 |
now2 = now
|
| 11 |
current_time = now2.strftime("%Y-%m-%d %H:%M:%S")
|
| 12 |
+
ki = f'{current_time}'
|
| 13 |
return ki
|
| 14 |
|
| 15 |
def load_fn(models):
|
|
|
|
| 25 |
noise = str(randint(0, 9999))
|
| 26 |
return models_load[model_str](f'{prompt} {noise}')
|
| 27 |
|
| 28 |
+
def extend_choices(choices):
|
| 29 |
+
return choices
|
| 30 |
+
|
| 31 |
def make_me():
|
| 32 |
+
default_models = ['model1', 'model2']
|
| 33 |
+
num_models = len(models)
|
|
|
|
| 34 |
|
| 35 |
with gr.Row():
|
| 36 |
txt_input = gr.Textbox(label='Your prompt:', lines=3)
|
|
|
|
| 48 |
stop_button.click(lambda s: gr.update(interactive=False), [stop_button], stop_button, cancels=[gen_event])
|
| 49 |
|
| 50 |
with gr.Accordion('Model selection'):
|
| 51 |
+
model_choice = gr.CheckboxGroup(models, label=f'{num_models} different models selected', value=default_models, interactive=True)
|
| 52 |
model_choice.change(update_imgbox, model_choice, output)
|
| 53 |
model_choice.change(extend_choices, model_choice, current_models)
|
| 54 |
|
|
|
|
| 63 |
gr.Markdown("<script>" + js_code + "</script>")
|
| 64 |
make_me()
|
| 65 |
|
| 66 |
+
demo.queue(concurrency_count=200)
|
| 67 |
demo.launch()
|