Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,12 +5,15 @@ import os
|
|
| 5 |
# API ссылка
|
| 6 |
url = "https://stablediffusionapi.com/api/v4/dreambooth"
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
# Функция для отправки запроса
|
| 10 |
-
def render(prompt, negative_prompt, width, height,
|
| 11 |
data = {
|
| 12 |
"key": api_key,
|
| 13 |
-
"model_id":
|
| 14 |
"prompt": prompt,
|
| 15 |
"negative_prompt": negative_prompt,
|
| 16 |
"width": width,
|
|
@@ -19,8 +22,8 @@ def render(prompt, negative_prompt, width, height, upscale, api_key):
|
|
| 19 |
"num_inference_steps": "40",
|
| 20 |
"safety_checker": "no",
|
| 21 |
"enhance_prompt": "yes",
|
| 22 |
-
"seed":
|
| 23 |
-
"guidance_scale":
|
| 24 |
"multi_lingual": "no",
|
| 25 |
"panorama": "no",
|
| 26 |
"self_attention": "no",
|
|
@@ -40,12 +43,14 @@ def render(prompt, negative_prompt, width, height, upscale, api_key):
|
|
| 40 |
gr.Interface(
|
| 41 |
render,
|
| 42 |
inputs=[
|
|
|
|
| 43 |
gr.Textbox(label="Описание изображения:", placeholder="Введите описание изображения", lines=3),
|
| 44 |
gr.Textbox(label="Negative Prompt:", placeholder="Введите Negative Prompt", value="[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry"),
|
| 45 |
gr.Slider(show_label=True, minimum=256, maximum=2048, label="Ширина:", value="512", step=1),
|
| 46 |
gr.Slider(show_label=True, minimum=256, maximum=2048, label="Высота:", value="512", step=1),
|
|
|
|
|
|
|
| 47 |
gr.Dropdown(["yes", "no"], label="Upscale", value="no"),
|
| 48 |
-
gr.Textbox(label="Ваш API ключ", placeholder="API_KEY"),
|
| 49 |
],
|
| 50 |
outputs=gr.Image()
|
| 51 |
).launch()
|
|
|
|
| 5 |
# API ссылка
|
| 6 |
url = "https://stablediffusionapi.com/api/v4/dreambooth"
|
| 7 |
|
| 8 |
+
# API ключ
|
| 9 |
+
api_key = os.getenv("KEY")
|
| 10 |
+
|
| 11 |
|
| 12 |
# Функция для отправки запроса
|
| 13 |
+
def render(model, prompt, negative_prompt, width, height, guidance, seed, upscale):
|
| 14 |
data = {
|
| 15 |
"key": api_key,
|
| 16 |
+
"model_id": model,
|
| 17 |
"prompt": prompt,
|
| 18 |
"negative_prompt": negative_prompt,
|
| 19 |
"width": width,
|
|
|
|
| 22 |
"num_inference_steps": "40",
|
| 23 |
"safety_checker": "no",
|
| 24 |
"enhance_prompt": "yes",
|
| 25 |
+
"seed": seed,
|
| 26 |
+
"guidance_scale": guidance,
|
| 27 |
"multi_lingual": "no",
|
| 28 |
"panorama": "no",
|
| 29 |
"self_attention": "no",
|
|
|
|
| 43 |
gr.Interface(
|
| 44 |
render,
|
| 45 |
inputs=[
|
| 46 |
+
gr.Dropdown(["realistic-vision-51"], label="Модель", value="realistic-vision-51"),
|
| 47 |
gr.Textbox(label="Описание изображения:", placeholder="Введите описание изображения", lines=3),
|
| 48 |
gr.Textbox(label="Negative Prompt:", placeholder="Введите Negative Prompt", value="[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry"),
|
| 49 |
gr.Slider(show_label=True, minimum=256, maximum=2048, label="Ширина:", value="512", step=1),
|
| 50 |
gr.Slider(show_label=True, minimum=256, maximum=2048, label="Высота:", value="512", step=1),
|
| 51 |
+
gr.Slider(show_label=True, minimum=1, maximum=20, label="CFG Scale:", value="7.5", step=0.5),
|
| 52 |
+
gr.Slider(show_label=True, label="Seed:", minimum=-1, maximum=1000000, value=-1, step=1),
|
| 53 |
gr.Dropdown(["yes", "no"], label="Upscale", value="no"),
|
|
|
|
| 54 |
],
|
| 55 |
outputs=gr.Image()
|
| 56 |
).launch()
|