jw2yang commited on
Commit
fc2f581
1 Parent(s): 68119c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -131,7 +131,7 @@ def recognize_image(image, texts):
131
  output_map = (output_map - output_map.min()) / (output_map.max() - output_map.min())
132
  heatmap = show_cam_on_image(img_d, output_map, use_rgb=True)
133
 
134
- return Image.fromarray(heatmap), {texts.split(';')[i]: float(prediction[i]) for i in range(len(texts.split(';')))}
135
 
136
 
137
  image = gr.inputs.Image()
@@ -142,10 +142,13 @@ gr.Interface(
142
  fn=recognize_image,
143
  inputs=["image", "text"],
144
  outputs=[
 
 
 
 
145
  gr.outputs.Image(
146
  type="pil",
147
  label="zero-shot heat map"),
148
- label
149
  ],
150
  examples=[
151
  ["./elephants.png", "an elephant; an elephant walking in the river; four elephants walking in the river"],
 
131
  output_map = (output_map - output_map.min()) / (output_map.max() - output_map.min())
132
  heatmap = show_cam_on_image(img_d, output_map, use_rgb=True)
133
 
134
+ return {texts.split(';')[i]: float(prediction[i]) for i in range(len(texts.split(';')))}, Image.fromarray(img_d), Image.fromarray(heatmap)
135
 
136
 
137
  image = gr.inputs.Image()
 
142
  fn=recognize_image,
143
  inputs=["image", "text"],
144
  outputs=[
145
+ label,
146
+ gr.outputs.Image(
147
+ type="pil",
148
+ label="crop input"),
149
  gr.outputs.Image(
150
  type="pil",
151
  label="zero-shot heat map"),
 
152
  ],
153
  examples=[
154
  ["./elephants.png", "an elephant; an elephant walking in the river; four elephants walking in the river"],