JosephZ commited on
Commit
6b56922
·
verified ·
1 Parent(s): a6267cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -200,15 +200,15 @@ def generate_sgg(image):
200
  label = obj["id"]
201
  draw.rectangle(bbox, outline="red", width=3)
202
  draw.text((bbox[0], bbox[1] - 15), label, fill="red", font=font)
203
- except:
204
- pass
205
 
206
- return json.dumps(resp) if not isinstance(resp, str) else resp
 
 
207
 
208
  gr.Interface(
209
  fn=generate_sgg,
210
  inputs=gr.Image(type="pil"),
211
- outputs="text",
212
  title="R1-SGG: Compile Scene Graphs with Reinforcement Learning",
213
  description="Upload an image and generate a structured scene graph in JSON format."
214
  ).launch()
 
200
  label = obj["id"]
201
  draw.rectangle(bbox, outline="red", width=3)
202
  draw.text((bbox[0], bbox[1] - 15), label, fill="red", font=font)
 
 
203
 
204
+ return image, json.dumps(resp)
205
+ except:
206
+ return image, resp
207
 
208
  gr.Interface(
209
  fn=generate_sgg,
210
  inputs=gr.Image(type="pil"),
211
+ outputs=[gr.Image(type="pil"), gr.Textbox(label="Scene Graph")],
212
  title="R1-SGG: Compile Scene Graphs with Reinforcement Learning",
213
  description="Upload an image and generate a structured scene graph in JSON format."
214
  ).launch()