stzhao commited on
Commit
a13abfa
·
verified ·
1 Parent(s): 5a163b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -64,18 +64,18 @@ def render_annotations(annotations, image_dir):
64
 
65
  # Gradio interface function
66
  def gradio_interface(annotations_file, image_dir):
67
- annotations = load_annotations(annotations_file)
68
  annotated_images = render_annotations(annotations, image_dir)
69
- return annotated_images
70
 
71
  # Create Gradio interface
72
  iface = gr.Interface(
73
  fn=gradio_interface,
74
  inputs=[
75
- gr.inputs.File(label="Upload Annotations JSON File"),
76
- gr.inputs.Textbox(label="Image Directory")
77
  ],
78
- outputs=[gr.outputs.Carousel(gr.outputs.Image(type="file"), label="Annotated Images")],
79
  title="Paper Annotation Renderer",
80
  description="Upload an annotations JSON file and specify the image directory to render annotations onto the images."
81
  )
 
64
 
65
  # Gradio interface function
66
  def gradio_interface(annotations_file, image_dir):
67
+ annotations = load_annotations(annotations_file.name)
68
  annotated_images = render_annotations(annotations, image_dir)
69
+ return [gr.Image(value=image[0], label=image[1]) for image in annotated_images]
70
 
71
  # Create Gradio interface
72
  iface = gr.Interface(
73
  fn=gradio_interface,
74
  inputs=[
75
+ gr.File(label="Upload Annotations JSON File"),
76
+ gr.Textbox(label="Image Directory")
77
  ],
78
+ outputs=gr.Gallery(label="Annotated Images"),
79
  title="Paper Annotation Renderer",
80
  description="Upload an annotations JSON file and specify the image directory to render annotations onto the images."
81
  )