Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -147,11 +147,14 @@ with gr.Blocks(css=css) as myface:
|
|
147 |
with gr.Row():
|
148 |
with gr.Column(style="width=800px"):
|
149 |
output1=gr.Image(label=(f"{current_model}"))
|
150 |
-
|
151 |
-
|
152 |
-
|
|
|
153 |
Image.fromarray(np.array(output1, dtype=np.uint8)).save(image_path)
|
154 |
-
|
|
|
|
|
155 |
with gr.Row():
|
156 |
with gr.Column(scale=50):
|
157 |
input_text=gr.Textbox(label="Prompt Idea",lines=2)
|
|
|
147 |
with gr.Row():
|
148 |
with gr.Column(style="width=800px"):
|
149 |
output1=gr.Image(label=(f"{current_model}"))
|
150 |
+
# Check the type before attempting to save the image
|
151 |
+
if isinstance(output1, Image.Image): # Check if it's a PIL Image object
|
152 |
+
output1.save(image_path)
|
153 |
+
elif isinstance(output1, np.ndarray): # Check if it's a NumPy array
|
154 |
Image.fromarray(np.array(output1, dtype=np.uint8)).save(image_path)
|
155 |
+
else:
|
156 |
+
print(f"Warning: Unexpected type {type(output1)} for output1.")
|
157 |
+
|
158 |
with gr.Row():
|
159 |
with gr.Column(scale=50):
|
160 |
input_text=gr.Textbox(label="Prompt Idea",lines=2)
|