Update app.py
Browse files
app.py
CHANGED
|
@@ -59,7 +59,36 @@ def upscale_image(image, upscale_factor):
|
|
| 59 |
# В случае ошибки возвращаем сообщение об ошибке
|
| 60 |
return f"Error: {response.text}"
|
| 61 |
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
# Запуск интерфейса
|
| 65 |
demo.launch()
|
|
|
|
| 59 |
# В случае ошибки возвращаем сообщение об ошибке
|
| 60 |
return f"Error: {response.text}"
|
| 61 |
|
| 62 |
+
with gr.Blocks() as demo:
|
| 63 |
+
gr.Markdown("<style>footer {display: none;}</style>") # CSS для скрытия футера
|
| 64 |
+
with gr.Tabs():
|
| 65 |
+
with gr.TabItem("Базовые настройки"):
|
| 66 |
+
prompt_input = gr.Textbox(label="Prompt", lines=3, placeholder="Введите текст для генерации изображения")
|
| 67 |
+
with gr.TabItem("Расширенные настройки"):
|
| 68 |
+
seed_input = gr.Number(label="Seed", value=0)
|
| 69 |
+
sampling_method_input = gr.Radio(label="Sampling Method", choices=["random", "VQ-VAE", "DDIM"], value="random")
|
| 70 |
+
cfg_input = gr.Slider(label="CFG", minimum=0.0, maximum=1.0, value=0.7)
|
| 71 |
+
width_input = gr.Number(label="Width", value=256)
|
| 72 |
+
height_input = gr.Number(label="Height", value=256)
|
| 73 |
+
with gr.TabItem("Настройки апскейлинга"):
|
| 74 |
+
upscale_factor_input = gr.Slider(label="Увеличить в", minimum=2, maximum=6, value=2, step=1)
|
| 75 |
|
| 76 |
+
generate_button = gr.Button("Генерация")
|
| 77 |
+
generated_image_output = gr.Image(label="Сгенерированное изображение")
|
| 78 |
+
upscale_button = gr.Button("Улучшить качество")
|
| 79 |
+
upscaled_image_output = gr.Image(label="Изображение с улучшенным качеством")
|
| 80 |
+
|
| 81 |
+
# Обработчики кнопок
|
| 82 |
+
generate_button.click(
|
| 83 |
+
generate_image,
|
| 84 |
+
inputs=[prompt_input, seed_input, sampling_method_input, cfg_input, width_input, height_input],
|
| 85 |
+
outputs=generated_image_output
|
| 86 |
+
)
|
| 87 |
+
upscale_button.click(
|
| 88 |
+
upscale_image,
|
| 89 |
+
inputs=[generated_image_output, upscale_factor_input],
|
| 90 |
+
outputs=upscaled_image_output
|
| 91 |
+
)
|
| 92 |
+
|
| 93 |
# Запуск интерфейса
|
| 94 |
demo.launch()
|