awacke1 commited on
Commit
fe33e07
·
1 Parent(s): 59d4efc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
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
- if isinstance(output1, str):
151
- print(f"Warning: output1 is a string, not an array. Value: {output1}")
152
- else:
 
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)