Update app.py
Browse files
app.py
CHANGED
|
@@ -64,10 +64,6 @@ default_models = models[:num_models]
|
|
| 64 |
def extend_choices(choices):
|
| 65 |
return choices + (num_models - len(choices)) * ['NA']
|
| 66 |
|
| 67 |
-
def update_imgbox(choices):
|
| 68 |
-
choices_plus = extend_choices(choices)
|
| 69 |
-
return [gr.Image(None, label=m, visible=(m != 'NA'), elem_id="custom_image") for m in choices_plus]
|
| 70 |
-
|
| 71 |
# Обновление изображения
|
| 72 |
def update_imgbox(choices, width, height):
|
| 73 |
choices_plus = extend_choices(choices)
|
|
@@ -81,7 +77,6 @@ def update_imgbox(choices, width, height):
|
|
| 81 |
height=height
|
| 82 |
) for m in choices_plus
|
| 83 |
]
|
| 84 |
-
|
| 85 |
# Функция генерации
|
| 86 |
def gen_fn(model_str, prompt, width, height):
|
| 87 |
if model_str == 'NA' or model_str not in models_load:
|
|
@@ -96,6 +91,11 @@ def gen_fn(model_str, prompt, width, height):
|
|
| 96 |
except Exception as e:
|
| 97 |
print(f"Error generating image for model {model_str}: {e}")
|
| 98 |
return None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
# Функция основного интерфейса
|
| 101 |
def make_me():
|
|
|
|
| 64 |
def extend_choices(choices):
|
| 65 |
return choices + (num_models - len(choices)) * ['NA']
|
| 66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
# Обновление изображения
|
| 68 |
def update_imgbox(choices, width, height):
|
| 69 |
choices_plus = extend_choices(choices)
|
|
|
|
| 77 |
height=height
|
| 78 |
) for m in choices_plus
|
| 79 |
]
|
|
|
|
| 80 |
# Функция генерации
|
| 81 |
def gen_fn(model_str, prompt, width, height):
|
| 82 |
if model_str == 'NA' or model_str not in models_load:
|
|
|
|
| 91 |
except Exception as e:
|
| 92 |
print(f"Error generating image for model {model_str}: {e}")
|
| 93 |
return None
|
| 94 |
+
noise = str(randint(0, 9999999)
|
| 95 |
+
return models_load[model_str](f'{prompt} {noise}')
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
|
| 99 |
|
| 100 |
# Функция основного интерфейса
|
| 101 |
def make_me():
|