Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -10,29 +10,28 @@ api_key = os.getenv("KEY")
|
|
10 |
|
11 |
model_list = ["AbsoluteReality 1.8.1", "Elldreth's Vivid Mix", "Anything V5", "Openjourney V4", "Analog Diffusion", "Lyriel 1.6", "Realistic Vision 5.0", "Dreamshaper 8", "epiCRealism v5", "CyberRealistic 3.3", "ToonYou 6", "Deliberate 3"]
|
12 |
|
13 |
-
|
14 |
# Функция для отправки запроса
|
15 |
def render(prompt, model, negative_prompt, width, height, guidance, seed, upscale):
|
16 |
data = {
|
17 |
-
"key":
|
18 |
-
"model_id": model,
|
19 |
-
"prompt": prompt,
|
20 |
-
"negative_prompt": negative_prompt,
|
21 |
-
"width": width,
|
22 |
-
"height": height,
|
23 |
-
"samples": "1",
|
24 |
-
"num_inference_steps": "40",
|
25 |
-
"safety_checker": "no",
|
26 |
-
"enhance_prompt": "yes",
|
27 |
-
"seed": seed,
|
28 |
-
"guidance_scale": guidance,
|
29 |
-
"multi_lingual": "no",
|
30 |
-
"panorama": "no",
|
31 |
-
"self_attention": "no",
|
32 |
-
"upscale":
|
33 |
-
"embeddings": "embeddings_model_id",
|
34 |
-
"lora": "lora_model_id",
|
35 |
-
"webhook": None,
|
36 |
"track_id": None,
|
37 |
}
|
38 |
response = requests.post(url, json=data)
|
@@ -41,19 +40,25 @@ def render(prompt, model, negative_prompt, width, height, guidance, seed, upscal
|
|
41 |
else:
|
42 |
return None
|
43 |
|
44 |
-
tab_1
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
55 |
# UI
|
56 |
gr.Interface(
|
57 |
-
render,
|
58 |
-
|
|
|
59 |
).launch()
|
|
|
10 |
|
11 |
model_list = ["AbsoluteReality 1.8.1", "Elldreth's Vivid Mix", "Anything V5", "Openjourney V4", "Analog Diffusion", "Lyriel 1.6", "Realistic Vision 5.0", "Dreamshaper 8", "epiCRealism v5", "CyberRealistic 3.3", "ToonYou 6", "Deliberate 3"]
|
12 |
|
|
|
13 |
# Функция для отправки запроса
|
14 |
def render(prompt, model, negative_prompt, width, height, guidance, seed, upscale):
|
15 |
data = {
|
16 |
+
"key": api_key,
|
17 |
+
"model_id": model,
|
18 |
+
"prompt": prompt,
|
19 |
+
"negative_prompt": negative_prompt,
|
20 |
+
"width": width,
|
21 |
+
"height": height,
|
22 |
+
"samples": "1",
|
23 |
+
"num_inference_steps": "40",
|
24 |
+
"safety_checker": "no",
|
25 |
+
"enhance_prompt": "yes",
|
26 |
+
"seed": seed,
|
27 |
+
"guidance_scale": guidance,
|
28 |
+
"multi_lingual": "no",
|
29 |
+
"panorama": "no",
|
30 |
+
"self_attention": "no",
|
31 |
+
"upscale": upscale, # Исправлено: передавайте значение upscale
|
32 |
+
"embeddings": "embeddings_model_id",
|
33 |
+
"lora": "lora_model_id",
|
34 |
+
"webhook": None,
|
35 |
"track_id": None,
|
36 |
}
|
37 |
response = requests.post(url, json=data)
|
|
|
40 |
else:
|
41 |
return None
|
42 |
|
43 |
+
tab_1 = [
|
44 |
+
gr.Textbox(render, label="Описание изображения:", placeholder="Введите описание изображения", lines=3),
|
45 |
+
gr.Radio(render, interactive=True, value="Anything V5", show_label=True, label="Модель:", choices=model_list),
|
46 |
+
]
|
47 |
+
|
48 |
+
tab_2 = [
|
49 |
+
gr.Textbox(render, label="Negative Prompt:", placeholder="Введите Negative Prompt", value="[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry", lines=3),
|
50 |
+
gr.Slider(render, show_label=True, minimum=256, maximum=2048, label="Ширина:", value=512, step=1), # Исправлено: передавайте числовые значения
|
51 |
+
gr.Slider(render, show_label=True, minimum=256, maximum=2048, label="Высота:", value=512, step=1), # Исправлено: передавайте числовые значения
|
52 |
+
gr.Slider(render, show_label=True, minimum=1, maximum=20, label="CFG Scale:", value=7.5, step=0.5), # Исправлено: передавайте числовые значения
|
53 |
+
gr.Slider(render, show_label=True, label="Seed:", minimum=-1, maximum=1000000, value=-1, step=1),
|
54 |
+
gr.Dropdown(render, choices=["yes", "no"], label="Upscale", value="no"),
|
55 |
+
]
|
56 |
+
|
57 |
+
tabs = gr.Tab([tab_1, tab_2], title=["Базовые настройки", "Расширенные настройки"])
|
58 |
+
|
59 |
# UI
|
60 |
gr.Interface(
|
61 |
+
fn=render,
|
62 |
+
inputs=[tabs], # Исправлено: передавайте входные данные как список
|
63 |
+
outputs=gr.Image(),
|
64 |
).launch()
|