Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,15 +28,16 @@ def generate_cached_image(prompt, width, height, seed, model_name):
|
|
| 28 |
"Content-Type": "application/json"
|
| 29 |
}
|
| 30 |
data = {
|
| 31 |
-
"
|
| 32 |
-
"
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
|
|
|
| 36 |
}
|
| 37 |
|
| 38 |
try:
|
| 39 |
-
response = requests.post("https://api
|
| 40 |
response.raise_for_status()
|
| 41 |
image_data = response.content
|
| 42 |
image = Image.open(io.BytesIO(image_data))
|
|
@@ -49,8 +50,8 @@ def generate_cached_image(prompt, width, height, seed, model_name):
|
|
| 49 |
def get_image(prompt):
|
| 50 |
width = request.args.get('width', type=int, default=512)
|
| 51 |
height = request.args.get('height', type=int, default=512)
|
| 52 |
-
seed = request.args.get('seed', type=int,
|
| 53 |
-
model_name = request.args.get('model',
|
| 54 |
|
| 55 |
# Декодируем URL-кодированный prompt
|
| 56 |
prompt = urllib.parse.unquote(prompt)
|
|
|
|
| 28 |
"Content-Type": "application/json"
|
| 29 |
}
|
| 30 |
data = {
|
| 31 |
+
"inputs": prompt,
|
| 32 |
+
"parameters": {
|
| 33 |
+
"width": width,
|
| 34 |
+
"height": height,
|
| 35 |
+
"seed": seed
|
| 36 |
+
}
|
| 37 |
}
|
| 38 |
|
| 39 |
try:
|
| 40 |
+
response = requests.post(f"https://api-inference.huggingface.co/models/{model_name}", headers=headers, json=data)
|
| 41 |
response.raise_for_status()
|
| 42 |
image_data = response.content
|
| 43 |
image = Image.open(io.BytesIO(image_data))
|
|
|
|
| 50 |
def get_image(prompt):
|
| 51 |
width = request.args.get('width', type=int, default=512)
|
| 52 |
height = request.args.get('height', type=int, default=512)
|
| 53 |
+
seed = request.args.get('seed', type=int, default=22)
|
| 54 |
+
model_name = request.args.get('model', default="Shakker-Labs_FLUX.1-dev-LoRA-Logo-Design").replace('_', '/')
|
| 55 |
|
| 56 |
# Декодируем URL-кодированный prompt
|
| 57 |
prompt = urllib.parse.unquote(prompt)
|