Ashoka74 commited on
Commit
15e9ce6
1 Parent(s): 52a473a

Update app_2.py

Browse files
Files changed (1) hide show
  1. app_2.py +14 -1
app_2.py CHANGED
@@ -1155,6 +1155,7 @@ with block:
1155
  with gr.Row():
1156
  extracted_objects = gr.Image(type="numpy", label="Extracted Foreground", height=480)
1157
  extracted_fg = gr.Image(type="numpy", label="Extracted Foreground", height=480)
 
1158
 
1159
  with gr.Row():
1160
  run_button = gr.Button("Generate alternative angles")
@@ -1232,8 +1233,20 @@ with block:
1232
  example_quick_prompts.click(lambda x, y: ', '.join(y.split(', ')[:2] + [x[0]]), inputs=[example_quick_prompts, prompt], outputs=prompt, show_progress=False, queue=False)
1233
  example_quick_subjects.click(lambda x: x[0], inputs=example_quick_subjects, outputs=prompt, show_progress=False, queue=False)
1234
 
1235
- angles_fg = Image.fromarray(extracted_fg, 'RGB')
 
 
 
 
 
 
 
 
1236
  run_button.click(
 
 
 
 
1237
  fn=infer,
1238
  inputs=[
1239
  text_prompt,
 
1155
  with gr.Row():
1156
  extracted_objects = gr.Image(type="numpy", label="Extracted Foreground", height=480)
1157
  extracted_fg = gr.Image(type="numpy", label="Extracted Foreground", height=480)
1158
+ angles_fg = gr.Image(type="pil", label="Converted Foreground", height=480, visible=False)
1159
 
1160
  with gr.Row():
1161
  run_button = gr.Button("Generate alternative angles")
 
1233
  example_quick_prompts.click(lambda x, y: ', '.join(y.split(', ')[:2] + [x[0]]), inputs=[example_quick_prompts, prompt], outputs=prompt, show_progress=False, queue=False)
1234
  example_quick_subjects.click(lambda x: x[0], inputs=example_quick_subjects, outputs=prompt, show_progress=False, queue=False)
1235
 
1236
+
1237
+ def convert_to_pil(image):
1238
+ try:
1239
+ image = image.astype(np.uint8)
1240
+ return image
1241
+ except Exception as e:
1242
+ print(f"Error converting Numpy image to PIL :{e})
1243
+ return image
1244
+
1245
  run_button.click(
1246
+ fn=convert_to_pil,
1247
+ inputs=extracted_fg,
1248
+ outputs=angles_fg)
1249
+ .then(
1250
  fn=infer,
1251
  inputs=[
1252
  text_prompt,