backup
Browse files
app.py
CHANGED
@@ -78,15 +78,7 @@ def create_color_palette_image(colors):
|
|
78 |
ax.set_xticks([])
|
79 |
ax.set_yticks([])
|
80 |
|
81 |
-
#
|
82 |
-
buf = io.BytesIO()
|
83 |
-
plt.savefig(buf, format="png", bbox_inches="tight", dpi=100)
|
84 |
-
plt.close("all") # Close all figures to prevent memory leaks
|
85 |
-
plt.close(fig) # Explicitly close the current figure
|
86 |
-
|
87 |
-
# Convert to base64 string
|
88 |
-
buf.seek(0)
|
89 |
-
return buf
|
90 |
except Exception as e:
|
91 |
print(f"Error creating color palette: {e}")
|
92 |
return None
|
@@ -209,7 +201,7 @@ with gr.Blocks() as demo:
|
|
209 |
label="Lighting Details",
|
210 |
lines=2,
|
211 |
)
|
212 |
-
color_palette_output = gr.
|
213 |
label="Color Palette",
|
214 |
height=100,
|
215 |
)
|
|
|
78 |
ax.set_xticks([])
|
79 |
ax.set_yticks([])
|
80 |
|
81 |
+
return fig # Return the matplotlib figure directly
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
except Exception as e:
|
83 |
print(f"Error creating color palette: {e}")
|
84 |
return None
|
|
|
201 |
label="Lighting Details",
|
202 |
lines=2,
|
203 |
)
|
204 |
+
color_palette_output = gr.Plot(
|
205 |
label="Color Palette",
|
206 |
height=100,
|
207 |
)
|