Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -60,7 +60,15 @@ def generate_image(prompt, structure_image, style_image, depth_strength=15, styl
|
|
60 |
style_strength=style_strength,
|
61 |
api_name="/generate_image"
|
62 |
)
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
# Примеры для Gradio
|
66 |
examples = [
|
|
|
60 |
style_strength=style_strength,
|
61 |
api_name="/generate_image"
|
62 |
)
|
63 |
+
|
64 |
+
if isinstance(result, str) and os.path.exists(result):
|
65 |
+
output_image = Image.open(result)
|
66 |
+
elif isinstance(result, bytes):
|
67 |
+
output_image = Image.open(BytesIO(result))
|
68 |
+
else:
|
69 |
+
raise ValueError(f"Неожиданный тип результата API: {type(result)}")
|
70 |
+
|
71 |
+
return output_image
|
72 |
|
73 |
# Примеры для Gradio
|
74 |
examples = [
|