Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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.
|
| 76 |
-
gr.
|
| 77 |
],
|
| 78 |
-
outputs=
|
| 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 |
)
|