Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,11 +5,11 @@ import io
|
|
5 |
from PIL import Image
|
6 |
|
7 |
# API ссылка
|
8 |
-
url = "https://
|
9 |
|
10 |
|
11 |
# Функция для отправки запроса
|
12 |
-
def render(prompt, negative_prompt,
|
13 |
data = {
|
14 |
"key": api_key,
|
15 |
"model_id": "realistic-vision-51",
|
@@ -32,7 +32,7 @@ def render(prompt, negative_prompt, output_format, width, height, upscale, api_k
|
|
32 |
"webhook": None,
|
33 |
"track_id": None,
|
34 |
}
|
35 |
-
response = requests.post(url,
|
36 |
if response.status_code == 200:
|
37 |
return response.content
|
38 |
image = Image.open(io.BytesIO(response.content))
|
@@ -43,13 +43,12 @@ def render(prompt, negative_prompt, output_format, width, height, upscale, api_k
|
|
43 |
gr.Interface(
|
44 |
render,
|
45 |
inputs=[
|
46 |
-
gr.Textbox(placeholder="Введите описание изображения"),
|
47 |
-
gr.Textbox(placeholder="Введите
|
48 |
-
gr.Dropdown(["
|
49 |
-
gr.Dropdown(["256", "512", "1024", "2048"]),
|
50 |
-
gr.Dropdown(
|
51 |
-
gr.
|
52 |
-
gr.Textbox(placeholder="API_KEY"),
|
53 |
],
|
54 |
outputs=gr.Image()
|
55 |
).launch()
|
|
|
5 |
from PIL import Image
|
6 |
|
7 |
# API ссылка
|
8 |
+
url = "https://stablediffusionapi.com/api/v4/dreambooth"
|
9 |
|
10 |
|
11 |
# Функция для отправки запроса
|
12 |
+
def render(prompt, negative_prompt, width, height, upscale, api_key):
|
13 |
data = {
|
14 |
"key": api_key,
|
15 |
"model_id": "realistic-vision-51",
|
|
|
32 |
"webhook": None,
|
33 |
"track_id": None,
|
34 |
}
|
35 |
+
response = requests.post(url, json=data)
|
36 |
if response.status_code == 200:
|
37 |
return response.content
|
38 |
image = Image.open(io.BytesIO(response.content))
|
|
|
43 |
gr.Interface(
|
44 |
render,
|
45 |
inputs=[
|
46 |
+
gr.Textbox(label="Описание изображения:", placeholder="Введите описание изображения"),
|
47 |
+
gr.Textbox(label="Negative Prompt:", placeholder="Введите Negative Prompt"),
|
48 |
+
gr.Dropdown(label="Ширина:", ["256", "512", "1024", "2048"]),
|
49 |
+
gr.Dropdown(label="Длина:", ["256", "512", "1024", "2048"]),
|
50 |
+
gr.Dropdown(label="Upscale", ["yes", "no"]),
|
51 |
+
gr.Textbox(label="Ваш API ключ", placeholder="API_KEY"),
|
|
|
52 |
],
|
53 |
outputs=gr.Image()
|
54 |
).launch()
|