Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,12 +2,10 @@ import os
|
|
2 |
import gradio as gr
|
3 |
import numpy as np
|
4 |
from gradio_client import Client
|
5 |
-
from PIL import Image
|
6 |
|
7 |
-
# Используем переменные окружения для гибкости
|
8 |
MODEL_ID = os.getenv("MODEL_ID", "KingNish/SDXL-Flash")
|
9 |
MAX_IMAGE_SIZE = int(os.getenv("MAX_IMAGE_SIZE", "4096"))
|
10 |
-
BATCH_SIZE = int(os.getenv("BATCH_SIZE", "1"))
|
11 |
|
12 |
client = Client(MODEL_ID)
|
13 |
|
@@ -138,11 +136,9 @@ with gr.Blocks(css=css) as demo:
|
|
138 |
use_resolution_binning=True,
|
139 |
api_name="/run"
|
140 |
)
|
141 |
-
|
142 |
-
if isinstance(response, list) and "image" in response[0]:
|
143 |
results.append(response[0]["image"])
|
144 |
else:
|
145 |
-
# В случае некорректного ответа добавляем пустое изображение
|
146 |
results.append("")
|
147 |
return results, seed
|
148 |
|
|
|
2 |
import gradio as gr
|
3 |
import numpy as np
|
4 |
from gradio_client import Client
|
|
|
5 |
|
|
|
6 |
MODEL_ID = os.getenv("MODEL_ID", "KingNish/SDXL-Flash")
|
7 |
MAX_IMAGE_SIZE = int(os.getenv("MAX_IMAGE_SIZE", "4096"))
|
8 |
+
BATCH_SIZE = int(os.getenv("BATCH_SIZE", "1"))
|
9 |
|
10 |
client = Client(MODEL_ID)
|
11 |
|
|
|
136 |
use_resolution_binning=True,
|
137 |
api_name="/run"
|
138 |
)
|
139 |
+
if isinstance(response, list) and response[0].get("image"):
|
|
|
140 |
results.append(response[0]["image"])
|
141 |
else:
|
|
|
142 |
results.append("")
|
143 |
return results, seed
|
144 |
|