Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
import os
|
| 4 |
-
import io
|
| 5 |
-
from PIL import Image
|
| 6 |
|
| 7 |
# API ссылка
|
| 8 |
url = "https://stablediffusionapi.com/api/v4/dreambooth"
|
|
@@ -15,27 +13,26 @@ def render(prompt, negative_prompt, width, height, upscale, api_key):
|
|
| 15 |
"model_id": "realistic-vision-51",
|
| 16 |
"prompt": prompt,
|
| 17 |
"negative_prompt": negative_prompt,
|
| 18 |
-
"width":
|
| 19 |
-
"height":
|
| 20 |
-
"samples":
|
| 21 |
-
"num_inference_steps":
|
| 22 |
-
"safety_checker":
|
| 23 |
-
"enhance_prompt":
|
| 24 |
-
"seed":
|
| 25 |
-
"guidance_scale":
|
| 26 |
-
"multi_lingual":
|
| 27 |
-
"panorama":
|
| 28 |
-
"self_attention":
|
| 29 |
-
"upscale":
|
| 30 |
-
"embeddings":
|
| 31 |
-
"lora":
|
| 32 |
-
"webhook":
|
| 33 |
-
"track_id":
|
| 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))
|
| 39 |
else:
|
| 40 |
return None
|
| 41 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import requests
|
| 3 |
import os
|
|
|
|
|
|
|
| 4 |
|
| 5 |
# API ссылка
|
| 6 |
url = "https://stablediffusionapi.com/api/v4/dreambooth"
|
|
|
|
| 13 |
"model_id": "realistic-vision-51",
|
| 14 |
"prompt": prompt,
|
| 15 |
"negative_prompt": negative_prompt,
|
| 16 |
+
"width": width,
|
| 17 |
+
"height": height,
|
| 18 |
+
"samples": "1",
|
| 19 |
+
"num_inference_steps": "40",
|
| 20 |
+
"safety_checker": "no",
|
| 21 |
+
"enhance_prompt": "yes",
|
| 22 |
+
"seed": None,
|
| 23 |
+
"guidance_scale": 7.5,
|
| 24 |
+
"multi_lingual": "no",
|
| 25 |
+
"panorama": "no",
|
| 26 |
+
"self_attention": "no",
|
| 27 |
+
"upscale": "no",
|
| 28 |
+
"embeddings": "embeddings_model_id",
|
| 29 |
+
"lora": "lora_model_id",
|
| 30 |
+
"webhook": None,
|
| 31 |
+
"track_id": None,
|
| 32 |
}
|
| 33 |
response = requests.post(url, json=data)
|
| 34 |
if response.status_code == 200:
|
| 35 |
return response.content
|
|
|
|
| 36 |
else:
|
| 37 |
return None
|
| 38 |
|