Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -68,7 +68,17 @@ def send_it1(inputs, model_choice):
|
|
68 |
with open(prompt_path, 'w') as f:
|
69 |
f.write(inputs[0])
|
70 |
|
71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
saved_output.update(list_saved_prompts_and_images())
|
74 |
|
|
|
68 |
with open(prompt_path, 'w') as f:
|
69 |
f.write(inputs[0])
|
70 |
|
71 |
+
# Check the type of output1 before saving
|
72 |
+
if isinstance(output1, np.ndarray): # If it's a numpy array
|
73 |
+
Image.fromarray(np.uint8(output1)).save(image_path)
|
74 |
+
elif isinstance(output1, Image.Image): # If it's already a PIL Image
|
75 |
+
output1.save(image_path)
|
76 |
+
elif isinstance(output1, str): # If it's a string (this should not happen in ideal conditions)
|
77 |
+
print(f"Warning: output1 is a string. Cannot save as image. Value: {output1}")
|
78 |
+
else:
|
79 |
+
print(f"Warning: Unexpected type {type(output1)} for output1.")
|
80 |
+
|
81 |
+
#Image.fromarray(output1).save(image_path)
|
82 |
|
83 |
saved_output.update(list_saved_prompts_and_images())
|
84 |
|